<br><br><div><span class="gmail_quote">On 4/16/07, <b class="gmail_sendername">Mitar</b> <<a href="mailto:firstname.lastname@example.org">email@example.com</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi!<br><br>On 4/16/07, Bertram Felgenhauer <<a href="mailto:firstname.lastname@example.org">email@example.com</a>> wrote:<br>> > Since all the threads block on a single MVar how do they run in
<br>> > parallel?<br>><br>> The idea is that before the threads block on the MVar, they run their<br>> action x to completion.<br><br>The rendering crashes. I will have to precompute the values in threads<br>
someway and then sequentially draw it? Any suggestion how to do that?<br><br></blockquote></div><br>Rendering into the same rendering context from multiple threads at the same time is a baaad idea.<br><br>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.
<br clear="all"><br>-- <br>Sebastian Sylvan<br>+44(0)7857-300802<br>UIN: 44640862