[Haskell-cafe] Re: Waiting for thread to finish

Brad Clow brad at bjclow.org
Wed Nov 28 00:11:19 EST 2007

On Nov 28, 2007 2:39 PM, Matthew Brecknell <haskell at brecknell.org> wrote:
> Brad Clow:
> Don's library is fairly simple. It adds a strictness annotation to force
> each value you write to a MVar or Chan, so for example,
> (Control.Concurrent.MVar.Strict.putMVar v x) is basically equivalent to
> (Control.Concurrent.MVar.putMVar v $! x).
> This is useful for returning results from worker threads, because it
> makes it more likely that the worker thread actually does the work. I
> say, "more likely", because the strictness annotation only forces the
> value to WHNF. If you have a deep structure, you might need a more
> sophisticated forcing function.

When I (deeply) force the worker thread's results to be strict, I
observe both cores working, but the execution time (elapsed) slower.
As much as a like the Haskell type system, sometimes butting your head
up against a wall is less painful than trying to optimise for speed.


Recycle is good: Reuse is better

More information about the Haskell-Cafe mailing list