[Haskell-cafe] Threads freezing

Roel van Dijk vandijk.roel at gmail.com
Sun Apr 25 10:45:26 EDT 2010


The problem could be in your use of forkIO.

To quote the documentation of forkOS [1]:

>Like forkIO, this sparks off a new thread to run the IO computation passed as the first argument, and returns the ThreadId of the newly created thread.
>However, forkOS creates a bound thread, which is necessary if you need to call foreign (non-Haskell) libraries that make use of thread-local state, such as OpenGL (see Control.Concurrent).

So you have to make sure that all calls to OpenGL originate from a
bound thread and furthermore that all calls to OpenGL originate from
_the same_ thread.

Regards,
Roel


1 - http://hackage.haskell.org/packages/archive/base/4.2.0.1/doc/html/Control-Concurrent.html#v%3AforkOS


More information about the Haskell-Cafe mailing list