From: <wag...@se...> - 2012-09-04 22:18:12
|
Quoting tim...@se...: > 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 |