Ticket #3160 (closed bug: wontfix)
No exception safety in Control.Concurrent.QSem QSemN and SampleVar
| Reported by: | ChrisKuklewicz | Owned by: | simonmar |
|---|---|---|---|
| Priority: | normal | Milestone: | 7.6.1 |
| Component: | libraries/base | Version: | 7.0.2 |
| Keywords: | Cc: | greenrd@…, ChrisKuklewicz, hackage.haskell.org@… | |
| Operating System: | Unknown/Multiple | Architecture: | Unknown/Multiple |
| Type of failure: | Incorrect result at runtime | Difficulty: | Unknown |
| Test Case: | Blocked By: | ||
| Blocking: | Related Tickets: |
Description
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
Change History
Note: See
TracTickets for help on using
tickets.
