[Haskell-cafe] gtk2hs and runghc

Ross Mellgren rmm-haskell at z.odi.ac
Wed Sep 23 15:52:21 EDT 2009


Well, keep in mind forkIO *might* be a different OS thread (unless  
it's bound, IIRC), depending on the number of workers (with -Nx) and  
so on.

-Ross

On Sep 23, 2009, at 2:24 PM, Günther Schmidt wrote:

> Am 23.09.2009, 19:29 Uhr, schrieb Duncan Coutts <duncan.coutts at worc.ox.ac.uk 
> >:
>
>> On Tue, 2009-09-22 at 17:08 -0400, Brandon S. Allbery KF8NH wrote:
>>> -----BEGIN PGP SIGNED MESSAGE-----
>>> Hash: SHA1
>>>
>>> On Sep 22, 2009, at 11:31 , Günther Schmidt wrote:
>>> > Gtk2hs then complains about running in a multithreaded ghc, ie.  
>>> one
>>> > with several "real" OS threads. Is it possible to start runghc
>>> > single-threaded?
>>>
>>>
>>> No, but you can unsafeInitGUIForThreadedRTS.
>>
>> If you observe the foot-shooting restrictions (of which the easiest  
>> is
>> to not use forkIO).
>>
>>
>> Duncan
>>
>
> And exactly herein lies the problem :)
>
>
> I've seen your response to the recent post about gui state, in which  
> you mention your own prefered solution to the problem, ie. that you  
> "post" your state to a channel which is read in a thread.
>
> I'm doing the same thing, but I'm also "calling" gui code from  
> within that thread. I figured since the thread itself isn't a  
> separate OS thread it shouldn't be a problem.
>
> It seems to work once the app is compiled, but running the code in  
> either ghci or with runghc it crashes.
>
> Günther
>
>
>
>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe



More information about the Haskell-Cafe mailing list