[GUI] A case of use involving threads

Axel Simon A.Simon@ukc.ac.uk
Thu, 13 Mar 2003 14:18:06 +0000


On Thu, Mar 13, 2003 at 06:52:46AM +0000, Glynn Clements wrote:
> 
> Nick Name wrote:
> 
> > If threadsafe does not exist, what are the alternatives? Would them
> > easily be handled by a clever design of CGA? What sort of design? Can
> > threads be spawned in C and then be used in haskell? Would this be a
> > mess instead?
> 
> If threads aren't an option, you may be able to use timer and/or idle
> callbacks.
 Yes, I think it would work. But it is quite subtle. This code does 
execute both event loops even without OS threads:
main = do
  addLibraryAIdleCallback yield
  forkIO libraryAmainLoop
  addLibraryBIdleCallback yield
  forkIO libraryBmainLoop

Axel.