Open byorgey opened 10 years ago
Some notes:
spawn
(http://hackage.haskell.org/package/spawn-0.3) has an abstraction for running things in a pool but it uses a deprecated API.QSem
, something like newQSem n >>= \qs -> async (map (bracket (waitQSem qs) (signalQSem qs)) actions)
(from @luite)async
. Can't use Chan
since there's no way to check if it's empty. Instead use Control.Concurrent.STM.TChan
.worker c = join $ atomically (readTChan c >>= return . (>> worker c) <|> return ())
I implemented something on the parallel branch 1d5bc08493a9b34d254ce7e5894ec989c82c5f66 but when I run I get the disappointing message:
This version of GHC is not thread-safe,can't safely run two instances of the interpreter simultaneously
How sad!
Bummer! See http://ghc.haskell.org/trac/ghc/ticket/3373 . I suppose one workaround would be to actually fire up N copies of the RTS in different OS processes? But that would probably have a lot of overhead, and I don't know if it would be worth the trouble.
diagrams-haddock
has some embarrassing parallelism going on. We should add a -j flag that turns on multithreading.