#3160: No exception safety in Control.Concurrent.QSem QSemN and SampleVar ------------------------------------------+--------------------------------- Reporter: ChrisKuklewicz | Owner: Type: bug | Status: new Priority: normal | Milestone: 7.6.1 Component: libraries/base | Version: 7.0.2 Resolution: | Keywords: Os: Unknown/Multiple | Architecture: Unknown/Multiple Failure: Incorrect result at runtime | Difficulty: Unknown Testcase: | Blockedby: Blocking: | Related: ------------------------------------------+---------------------------------
Comment(by ChrisKuklewicz): I have updated SafeSemaphore to 0.9.0 on hackage and git, http://github.com/ChrisKuklewicz/SafeSemaphore I have done several different things with this release: There is a new Control.Concurrent.SSem module based on STM that is dead simple and replaces QSem and QSemN. I have not made a SampleVar replacement with STM yet. The raw STM version is in Control.Concurrent.STM.SSem. This does guarantee FIFO operation and so has different starvation possibilities, especially with big and small requests to waitN. The MSem.hs file is now a literate MSem.lhs file. This has much more elaborate comments discussing how the invariants are maintained. The uninteruptableMask_ is only being used for the quick signal operation to ensure bracket works properly. The MSemN.hs file is now a literate MSemN.lhs file. This has extensively documented invariants and short "proof" arguments that they are maintained. The uninteruptableMask_ is used both in signal and to recover from interrupted wait operators. The new MSemN2.hs file is a variant of MSemN.lhs that does NOT use uninteruptableMask_ in the wait operation at all. Instead it makes every wait call check for the possible interruption of the previous wait. The uninteruptableMask_ is not used on every signal call, but is used in the with combinator to guard its call to signal. For replacing QSem/QSemN/SampleVar I will update the patch with the consensus design. I have announced this 0.9.0 release to the Haskell-Cafe mailing list and included a link to this ticket. -- Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/3160#comment:19> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler _______________________________________________ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs