[GHC] #3160: No exception safety in Control.Concurrent.QSem QSemN
and SampleVar
GHC
trac at galois.com
Wed Apr 8 07:08:05 EDT 2009
#3160: No exception safety in Control.Concurrent.QSem QSemN and SampleVar
-----------------------------+----------------------------------------------
Reporter: ChrisKuklewicz | Owner:
Type: bug | Status: new
Priority: normal | Component: libraries/base
Version: 6.10.2 | Severity: major
Keywords: | Testcase:
Os: Unknown/Multiple | Architecture: Unknown/Multiple
-----------------------------+----------------------------------------------
Looking at the code for QSem, QSemN, and SampleVar shows they all use a
"takeMVar" then "putMVar" programming idiom.
None of these are exception safe. An unlucky killThread will leave the
MVar empty and cause the rest of the program to malfunction.
The solution is to rewrite them using withMVar and modifyMVar(_) to
prevent the MVar from being left empty in the event of an exception.
Note: QSem also needs the bugfix in #3159
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/3160>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the Glasgow-haskell-bugs
mailing list