From: Axel S. <A....@ke...> - 2004-05-14 13:52:15
|
On 14 May 2004, at 15:05, Duncan Coutts wrote: > On Fri, 2004-05-14 at 09:13, Axel Simon wrote: >> On 12 May 2004, at 20:29, Duncan Coutts wrote: >>> The attached code does a similar thing but in the other direction, it >>> installs ghc's event loop into gtk's event loop. > >> Hm, ok, that is definitely a nice hack. However if this will not work >> with a threaded GHC, then I guess it's a no-go. I think it can be >> assumed that threaded RTS will be the standard in the future. > > It would work only if we can bind all Haskell threads that want to > access the GUI to the OS thread that is running gtk_main. > > It would need an extension of the bound threads API to specify which OS > thread to bind to so you can bind to a existing OS thread. Wolfgang is > sceptical of this however, so this probably is a no-go. > > When people eventually get a high-level Haskell gui API, there might be > more pressure for a solution, since several high-level designs I've > seen > make heavy use of threads and it would be too great a burden to think > about locking. > Maybe we've approached the problem from the wrong end. Basically, we should make the user run gtkMain in the main thread which will block. If the user forks of a process before the call to gktMain, then all accesses to the GUI library in all forked processes must be protected by the locking function. I think this rule is not too complicated and is kind of intuitive. What do you think? Axel. |