Open SirVer opened 9 years ago
Another solution would be to add a thread-safe rustbox::wakeup() that would fire a wakeup event, so other threads could force a redraw.
I'll add to this that I really like the idea of using a channel for the event stream.
Right now, rustbox blocks in
poll_event
and there is no way of waking it up. An external event in another thread does not seem to have any means of triggering a redraw without using peek_event in a busy loop.I think a cleaner design would be to replace
poll_event
through ampsc::channel
. The consumer could then select over multiple channels to act on multiple inputs andpeek_event
could just be idiomatically replaced throughhttps://doc.rust-lang.org/nightly/std/iter/struct.Peekable.html
. This would also allow for the very intuitive for loop syntax: