[Haskell-cafe] Re: Re: Threading and FFI
zao at acc.umu.se
Sun Feb 21 18:30:57 EST 2010
On 02/21/2010 09:51 PM, Ben Franksen wrote:
> Yves Parès wrote:
>> Just one last remark: when I moved all my OpenGL calls from the main
>> thread to an unbound thread. I thought it'd not work -- because I assumed
>> I would have to launch it in a bound thread -- and however it went
> You were just lucky the RTS accidentally delegated all your OpenGL calls to
> the same OS thread. It might turn out bad next time you run the program, or
> on another machine, or after adding more threads. Been there...
I've been hacking on a DirectX binding recently where just about all
calls have thread affinity as well.
The effect of running calls on the wrong thread there was (on my
machine, running Seven) making the whole Windows GUI flicker. I wouldn't
be surprised if it'd crash on other platforms.
Remember, undefined behaviour is not always kind enough to fail hard.
More information about the Haskell-Cafe