Can you post events to an X apps event queue like you can use PostMessage() to post messages to a Windows app?

What I mean is I have an X app that starts a worker thread. The main thread handles the gui and sends /gets commands/responses from the worker thread. The worker thread, wel performs work. In Windows I would use the PostThreadMessage() and PostMessage() to do this. How could this be done in X.

From the gui to the worker thread is no problem. Set up a mutex protected queue between the two and the thread does a conditional wait until teh gui posts something.

But, can the thread put a special event on the gui's event handler and teh gui have a callback for that event?

I guess you could have a queue from worker thread to gui and the gui check it in the event loop handler. Instead of using XtAppMainLoop() you would do this:

for(;;){
if(CheckThreadQueue()) ProcessQueueData();
if(XtPeekEvent){
XtAppNextEvent();
XtDispatchevent();
} }
PS: I am no X expert by a long shot. I have use mostly Tcl/Tk and xforms and very little low level, Xt, programming.


Jeff
[EMAIL PROTECTED]

_______________________________________________
XFree86 mailing list
[EMAIL PROTECTED]
http://XFree86.Org/mailman/listinfo/xfree86

Reply via email to