[Haskell-cafe] Suggestiong for inter-thread communication

Erik de Castro Lopo mle+hs at mega-nerd.com
Sat Jan 26 09:24:33 CET 2013


Hi all,

I am in the process of writing a Haskell program consisting of two
threads, one for performing a calculation and one for an Ncurses UI
(haskell-ncurses).

The calculation thread needs to feed a stream of numbers back to the
UI thread (about 1 value per second) and the UI needs to take input
from the user and will pass parameter changes to the calculation
thread using an IORef and atomicModifyIORef.

However, I'm not sure how to hande the UI thread. The UI thread would
normally wait for Ncurses input using getEvent, but I need advice on
how to the the data from the calculation thread.

Any advice or things to try?

Cheers,
Erik
-- 
----------------------------------------------------------------------
Erik de Castro Lopo
http://www.mega-nerd.com/



More information about the Haskell-Cafe mailing list