[Haskell-cafe] Re: RFC: concurrent-extra
marlowsd at gmail.com
Tue Feb 16 11:47:02 EST 2010
On 16/02/2010 15:51, Roel van Dijk wrote:
> We wrote a small library (1) which offers a few extra synchronization
> primitives. These primitives are found in the standard libraries of
> languages like Java and Python, but not in Haskell.
> Before releasing concurrent-extra on hackage, we would like some
> comments on its name, design, implementation, documentation (2) and
> general usefulness.
> All primitives are implemented with MVars and IORefs, except for
> There is a small test suite which tests some properties:
> cabal configure -ftest
> cabal build
> cabal test
> The test suite still needs to be expanded a great deal. We found that
> testing concurrent algorithms is really hard. Now we test things like
> "this shouldn't deadlock" by checking if it doesn't take too long. But
> that doesn't feel very formal. Is there a more principled approach to
> testing concurrent algorithms in Haskell?
You might want to take a look at the concurrency part of the GHC test suite:
Not that we've really solved the problem you're talking about, but you
might get some ideas.
Often deadlocks are caught by the RTS and result in an exception which
you can catch, though with the threaded RTS this relies on detecting
idle time and running the GC, which by default happens after 0.3s of
idle time. Some people find this annoying and turn off the idle-time GC
(+RTS -I0) but then you lose deadlock detection. Swings and roundabouts.
More information about the Haskell-Cafe