SafeSemapore

Chris Kuklewicz haskell at list.mightyreason.com
Sat Jun 2 14:22:47 CEST 2012


This message is in three parts: a problem, a solution, and a request for help.

The problem is that Control.Concurrent.QSem, QSemN, and SampleVar are all still
broken.  GHC ticket #3160 is still open [1].  These three synchronization
mechanisms can be irretrievable broken by a killThread on a blocked waiter.

The solution is that I am please to announce that SafeSemaphore has been updated
to 0.9.0 on hackage [2] and github.  These provides safe solutions to replace
QSem and QSemN, actually several such solutions.  See the github [2] page
(scroll down for README) for a summary of all the modules.

The request for help is that I would like to unbreak the Haskell Platform by
replacing the guts of QSem, QSemN, and SampleVar with SafeSemaphore.

Do you think my replacement is correct or buggy?  Can we get #3160 closed?

Replacing these will preserve their API but may tinker with corner case
undocumented behavior.  Should waiters block in FIFO order?  Should QSemN starve
big or small requests to be fairer?

[1] http://hackage.haskell.org/trac/ghc/ticket/3160  (three years old!)
[2] http://hackage.haskell.org/package/SafeSemaphore/
[3] https://github.com/ChrisKuklewicz/SafeSemaphore

Sincerely,
  Chris Kuklewicz



More information about the Libraries mailing list