Hi!

On 4/15/07, Spencer Janssen <[EMAIL PROTECTED]> wrote:
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

Attachment: Main.hs
Description: Binary data

_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to