| Janos Makadi 2004-06-26, 10:10 am |
| Ulrich Eckhardt wrote:
> Generally, that's a bad idea to have UI in several threads. You should
> rather make that thread send a message to the UI thread and ask it to pop
> up the alarm window.
You are absolutely right.
At first time, I started coding like that, but later I realized, ncurses
and CDK aren't thread safe. So if I want to handle keyboard input in
only one thread, I have to write my own UI, which able to use my input
schema. Or rewrite the parts in CDK which is relevant. (A little
explanation: The user do his job, fill forms etc. Event comes. A new
curses window must appear. This way it doesn't matter which thread puts
the new window to the screen, because the other thread which handles
forms, own's the stdin. Keyboard input goes to the form handling thread,
and the event window waits for infinity.) As I spend more and more time
to solve this problem, I guess the only way to write my own UI, and drop
CDK, but this is a big work. CDK has a lot good widgets, and I don't
want to rewrite it.
Thanks for your answer,
Regards,
Janos
|