readChan and unGetChan?
Simon Marlow
simonmarhaskell at gmail.com
Tue Apr 4 09:42:03 EDT 2006
Li, Peng wrote:
> Suppose the following happens:
>
> (1) Thread A calls readChan on an empty channel and waits
> (2) Thread B puts something to the read-end of the channel using unGetChan
>
> When a GHC program does this, both threads are blocked! Is it the
> behaviour we really want for unGetChan, or should we fix the
> implementation for Control.Concurrent.Chan?
Good point. Can you think of a good fix?
Interestingly, the STM TChan works perfectly in this respect. Draw your
own conclusion :)
Cheers,
Simon
More information about the Glasgow-haskell-users
mailing list