No exception safety in Control.Concurrent.QSem QSemN and SampleVar
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 (closed)
Trac metadata
Trac field | Value |
---|---|
Version | 6.10.2 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | libraries/base |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture |