Now I'm writing a console program. It needs to process user's input(such as some keystroke as commands) and at the same receives some data via serial ports and outputs them to the console.

I design the program using ncurses and thread library. I create two or three windows(using ncurses's newwin). One is for user's input, the other is for serial data output, the last one is for some status.

In addtion, I create two processes. One is for processing user's input, the other is for receiving data from serial ports.

But the question is , It doesnot runs well as I expected. When a process output some stuff to the console, the other process seems that it cannot grap the cpu and process my keystrokes?

I'm really confused. And I've tried a lot of methods and still can't get it working?

So anyone could help me? Any advice is welcome.

Thank you very much.