[Haskell-cafe] Suggestiong for inter-thread communication
tab at snarc.org
Sat Jan 26 11:08:56 CET 2013
On Sat, Jan 26, 2013 at 07:46:04AM -0200, Thiago Negri wrote:
> Do you need advice on what? I didn't understand your last phrase.
IIUC, it has to do which how to interrupt a blocking call to ncurses event
handling, from another thread (the calculation thread) to let the UI thread
refresh the UI with something to display (the calculation).
I've been confronted with the same problem in the past, and i haven't found a
satisfactory solution with ncurses.
Erik, I think the only way to do that with ncurses, is to wrap the ncurses
getevent with a select loop on the terminal fd and an arbitrary fd to be able
to "ping" the select loop for arbitrary processing. You can also replace the
arbitrary fd with a SIGALARM to yourself which i believe would interrupt select
too. I don't think there's any solution that integrate nicely with the haskell
way, but i'ld be happy to be wrong on this.
In my case, i switched to Vty which solved this problem, by allowing to send
arbitrary strongly-typed event to widgets.
More information about the Haskell-Cafe