Sorry for the long title. I am developing a network program in C which may display messages received from network on stdout and accept user input on stdin via the GNU readline library. The problem is, when the user is typing commands on the main thread via readline, a network message arrives and output to stdout, which will produce something like this:
Scenario:
Input: 1234567890
Network message: Hello
The network message arrives when the user just typed "7"
Actual output on terminal:
Input> 1234567Hello
890_
Is there a way to have the output like this?
Hello
Input> 1234567890_
p.s. _ is the cursor.
Thanks in advance!