Bug in emptySampleVar

Simon Marlow simonmar at microsoft.com
Tue Jan 20 07:50:49 EST 2004


 
> Hello!
> In my opinion there is a bug in the emptySampleVar-function in 
> Control.Concurrent.SampleVar.
> 
> emptySampleVar :: SampleVar a -> IO ()
> emptySampleVar v = do
>    (readers, var) <- takeMVar v
>    if readers >= 0 then
>  	takeMVar var >>    			<- I think this 
> line is missing
> 	putMVar v (0,var)
>    else
>      	putMVar v (readers,var)

And it looks to me like  "readers >= 0" should be "readers > 0".  Anyone
agree/disagree?

Cheers,
	Simon


More information about the Glasgow-haskell-bugs mailing list