From: Nick N. <nic...@in...> - 2003-02-24 18:23:35
|
On Mon, 24 Feb 2003 14:44:44 +0000 Axel Simon <A....@uk...> wrote: > I think this is the more clumsy version of forcing gtk and ghc run in > > parallel. Instead of running the main loop of Gtk once in a while I > think you are better off running Haskell when Gtk is idle: > > Gtk.idleAdd (yield >> return False) Gtk.priorityDefault > Gtk.mainGUI However, this does not work, and putting a sleep >> before that yield does not help, either. My current "state of the art" is something like: sequence_ $ repeat (do threadDelay 20000 whileM (Gtk.eventsPending >>= return . (0<)) (Gtk.mainIterationDo False) This is "just working", but it "just sucks" (TM) ! > calls of Gtk functions may run at the same time. As long as ghc does > not have native OS threads, this is not a problem. Consider http://www.cse.unsw.edu.au/~chak/haskell/ghc/comm/rts-libs/multi-thread.html Perhaps we have to wait when --enable-threaded-rts will become enabled by default in GHC (anyone has ideas? M.C. ?) Vincenzo |