
15 Apr
2007
15 Apr
'07
3:56 p.m.
Hi!
On 4/15/07, Spencer Janssen
This version will fork a new thread for each action:
\begin{code} import Control.Concurrent import Control.Monad
parSequence_ xs = do m <- newEmptyMVar mapM_ (\x -> forkIO x >> putMVar m ()) xs replicateM_ (length xs) (takeMVar m)
parMapM_ f xs = parSequence_ $ map f xs \end{code}
OpenGL bindings successfully crash. The functional calculations in f should be done in parallel, but those few OpenGL actions should still be done sequentially. I am attaching the code in question. It is a simple voxel raycasting engine. (Any suggestions on other memory/performance improvements are more than welcome.) Mitar