[Haskell-cafe] gtk2hs and runghc
duncan.coutts at worc.ox.ac.uk
Wed Sep 23 16:38:21 EDT 2009
On Wed, 2009-09-23 at 15:52 -0400, Ross Mellgren wrote:
> Well, keep in mind forkIO *might* be a different OS thread
> (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.
More information about the Haskell-Cafe