#3159: QSem fails with negative quantities
------------------------------+---------------------------------------------
Reporter: NeilMitchell | Owner:
Type: bug | Status: new
Priority: normal | Milestone:
Component: libraries/base | Version: 6.10.2
Severity: major | Resolution:
Keywords: | Testcase:
Os: Unknown/Multiple | Architecture: Unknown/Multiple
------------------------------+---------------------------------------------
Comment (by ChrisKuklewicz):
Can be fixed by changing waitQSem's
putMVar sem (0, blocked++[block])
to
putMVar sem (avail, blocked++[block])
and also change signalQSem to
> > signalQSem :: QSemN -> IO ()
> > signalQSem (QSemN sem) = modifyMVar_ free sem
> > where free (0,(b:bs)) = putMVar b () >> return (0,bs)
> > free (avail,blocked) = return (avail+1,blocked)
Note: QSem, QSemN, and SampleVar are all not exception safe.
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/3159#comment:2>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs