Under windows, the GUI thread usually call GetMessage to waiting for message,
when another thread use PoseMessage put a message into the queue, then the
GUI thread will return GetMessage (quit blocking).
Does anyone can tell me, when I use XNextEvent under XWindows to waiting for
event, how can I “wakeup” the GUI thread in another thread. Is there some
API like PoseMessage I can use ?.
No. This is why most UI frameworks (Gtk, KDE, etc) use custom main loops to be able to listen for more event sources.
Internally, XNextEvent uses a socket, so it calls
select()to know when input is available. CallConnectionNumber(display)to get the file descriptor that you need to passselect()That allows you to listen for several file descriptors.
Sample code from http://www.linuxquestions.org/questions/showthread.php?p=2431345#post2431345