[Haskell-cafe] Parallel executing of actions
sebastian.sylvan at gmail.com
Tue Apr 17 13:56:14 EDT 2007
On 4/16/07, Mitar <mmitar at gmail.com> wrote:
> On 4/16/07, Bertram Felgenhauer <bertram.felgenhauer at googlemail.com>
> > > Since all the threads block on a single MVar how do they run in
> > > parallel?
> > The idea is that before the threads block on the MVar, they run their
> > action x to completion.
> The rendering crashes. I will have to precompute the values in threads
> someway and then sequentially draw it? Any suggestion how to do that?
Rendering into the same rendering context from multiple threads at the same
time is a baaad idea.
I would suggest chunking up your work (assuming that calculating your colour
is indeed a significant amount of work) in tiles or something, then fork off
a thread for each of them, sticking the final colours in a Chan. Then you
have another thread just pick tiles off the Chan and copy the results to the
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Haskell-Cafe