Oh, I wish I had known about your tutorial a year ago!  I will link to it from the wiki.  And I will also remove the link to this http://projects.haskell.org/gtk2hs/archives/2005/07/24/writing-multi-threaded-guis/#more-38 as it's out of date and misleading(If the web-master for that site is on this list, they should put a big yellow disclaimer on that).  About using forkOS.  I have used the method I described, and so far not been able to link any problems to it.  It's not a problem though, if it turns out that there are problems with it, to do "initGUI >> forkOS mainGUI"
Being able to use an exitMVar is a must however.  You remember what I said about waiting for files to save before exiting.  Of course we could have a special exitWaitingForFilesToChange function.  But imagine what bits of state that function needs access to.  It causes a horrible spaggetiing of state to not be able to use the exit MVar method.

---------- Původní zpráva ----------
Od: wagnerdm@seas.upenn.edu
Datum: 5. 9. 2012
Předmět: Re: [Gtk2hs-users] New threaded GUI tutorial


Quoting timothyhobbs@seznam.cz:

> Hey,
> I just uploaded this http://www.haskell.org/haskellwiki/Gtk2Hs/Tutorials/
> ThreadedGUIs after a long time user claimed to me that threaded GUI was
> somehow not supported.  Hopefully I covered all the main points.  And
> hopefully there aren't too many horrible errors..
>
> Timothy

You might also like my own tutorial (which includes a bit more
discussion of Gtk and GHC internals):
http://dmwit.com/gtk2hs
You claim GTK is single-threaded; this is not true. GTK is
thread-agnostic on sane operating systems. However, it is true that
apps with cross-platform use as a goal should treat GTK as if it were
single-threaded: on Windows, calls bottom out at the Win32 API, which
uses thread-local state. Indeed, for this reason, I *think* your
advice to fork mainGUI is bad -- you want mainGUI to have access to
the thread-local state set up during program initialization. (Actually
not 100% sure about that one.)

Also, your suggestion to use unsafeInitGUIForThreadedRTS "to avoid
deprecation warnings" is backwards: unsafeInitGUI is the deprecated
one; initGUI now just Does The Right Thing with respect to the
threaded and non-threaded runtimes.

~d

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Gtk2hs-users mailing list
Gtk2hs-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gtk2hs-users