24 Sep
2009
24 Sep
'09
2:08 a.m.
On Wed, 2009-09-23 at 15:52 -0400, Ross Mellgren wrote:
Well, keep in mind forkIO *might* be a different OS thread
Yes.
(unless it's bound, IIRC)
In which case it's guaranteed to be on a different OS thread..
depending on the number of workers (with -Nx) and so on.
The number of capabilities is mostly unrelated. All these problems will happen with -N1 and -N2. Essentially each capability has a pool of OS threads. Only one of these OS threads runs Haskell code at once, but which one it is at any particular time is not defined. The trick that postGUI uses is to arrange for a foreign callback (from C into Haskell) on the OS thread running the GUI. This creates a Haskell thread that runs on that OS thread until the callback returns. Duncan