Re: A case of use involving threads

Axel Simon <[email protected]>
Newsgroups gmane.comp.lang.haskell.gui
Message-ID <[email protected]>
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.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.