[6 / 0 / ?]
Quoted By:
dearest /prog/
I am trying to write an instant messaging program in C. I have come to a brick wall, however. how do I handle these three things concurrently: refreshing the display (in my case, a basic ncurses window), accepting input (stdin), writing & reading from the socket?
the main issue is that input blocks anything else from happening. is it possible to pass the file descriptor for stdin to another thread, then for that thread to update the char* array for the input ncurses window, then that is finally updated by the main thread? then, after the input is 'ready', it is written to the socket.
meanwhile, the read thread would accept and write data to a char** array, holding the data for the recent messages (which is then updated by the main thread thru ncurses windows).
am i thinking in any logical sense? how would you wizards accomplish this? also, to reiterate my question, could I pass the stdin file descriptor to another thread which then processes it?
thx
I am trying to write an instant messaging program in C. I have come to a brick wall, however. how do I handle these three things concurrently: refreshing the display (in my case, a basic ncurses window), accepting input (stdin), writing & reading from the socket?
the main issue is that input blocks anything else from happening. is it possible to pass the file descriptor for stdin to another thread, then for that thread to update the char* array for the input ncurses window, then that is finally updated by the main thread? then, after the input is 'ready', it is written to the socket.
meanwhile, the read thread would accept and write data to a char** array, holding the data for the recent messages (which is then updated by the main thread thru ncurses windows).
am i thinking in any logical sense? how would you wizards accomplish this? also, to reiterate my question, could I pass the stdin file descriptor to another thread which then processes it?
thx