[Haskell-cafe] Rewriting a Python application to Haskell

Bulat Ziganshin bulat.ziganshin at gmail.com
Sat Sep 2 03:00:45 EDT 2006


Hello Neil,

Friday, September 1, 2006, 6:47:12 PM, you wrote:

> I have no idea about wxHaskell and STM, but I found out that hard way
> that Gtk2Hs + threads = bad idea.

Duncan Coutts, gtk2hs author, writes the same and proposed solution -
use dedicated thread to execute all graphics commands and send these
commands to the thread using Chan. it's just several lines of code:

   c <- newChan
   forkOS (graphicsThread c)
   writeChan c (drawCircle ...)

graphicsThread c =
   forever $ do
     cmd <- readChan c
     cmd

Just mention that forkOS, but not forkIO, should be used. one my
friend tried this setting and it worked fine


-- 
Best regards,
 Bulat                            mailto:Bulat.Ziganshin at gmail.com



More information about the Haskell-Cafe mailing list