[Haskell-cafe] what GUI library should i select?
akamaus at gmail.com
Tue Nov 14 05:26:36 EST 2006
Bulat Ziganshin wrote:
> it is what i say about. threaded RTS + multipls threads that does
> computations + one thread that interfaces with Gtk2Hs. afaiu, the only
> problem is that i need to manage both Gtk events and periodically
> check queue of commands from other threads, but using timer + Chan
> should allow to implement this
I wrote multi threaded gui application in Haskell last spring as a educational
project. That was a tool for analyzing and extracting contents of FAT volumes.
Then i started my project, i was completely unaware of these threading issues
and freely called gtk2hs routines from several threads. All worked fine at
first, but when i added some disk I/O to my threads, my program became unstable.
While on linux it just crashed from time to time, on windows i saw more curious
behavior. At random spots threads lost ability to call WinAPI functions.
Basically they got an error code meaning something weird like "insufficient
memory to complete call" in return. That was not easily reproducible and
depended on exact version of Windows. At some point my app was fully functional
on WinXP and didn't even start on Win2000.
I spent a lot of time trying to debug these issues and finally refactored my
program to make use of approach you describe. Worked fine after that. All you
have to do is to choose appropriate timer interval, otherwise your app becomes
too jerky or CPU hungry.
More information about the Haskell-Cafe