On 4/16/07, Mitar <mmitar@gmail.com> wrote:
Hi!
On 4/16/07, Bertram Felgenhauer <bertram.felgenhauer@googlemail.com> wrote:
> > 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 frame buffer.
--
Sebastian Sylvan
+44(0)7857-300802
UIN: 44640862