From: Evan M. <ev...@go...> - 2005-07-26 01:15:59
|
On 7/24/05, Duncan Coutts <dun...@wo...> wrote: > I was asking people on IRC for some feedback on an article I just added > on writing multi-threaded GUIs with Gtk2Hs: > http://haskell.org/gtk2hs/archives/2005/07/24/writing-multi-threaded-guis= / When I first started learning about Haskell's IO system the GTK threading requirement is one of the first things I thought of. On Windows, as I recall, it's not only that GTK isn't thread safe but it's also that fundamentally the way the Windows event loop works and how GTK uses it that you just can't do GUI operations from external threads. (At least, this is my vague memory -- please don't quote me on it. :P) Without thinking about it too hard at least, you could imagine having all GTK operations that are performed in callbacks just feed their IO actions into a queue that the "main" thread executes. I guess now that I write that you'd want to give them a different type, like GtkIO, and then it'd complicate the types of functions... I haven't really thought it fully through, nor do I understand how Haskell IO "really" works, so it won't hurt my feelings if you tell me this is a stupid idea. :) |