Posting events to application event queue. Can you?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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
wd4nmq@xxxxxxxxxxx

_______________________________________________
XFree86 mailing list
XFree86@xxxxxxxxxxx
http://XFree86.Org/mailman/listinfo/xfree86

[Index of Archives]     [X Forum]     [Xorg]     [XFree86 Newbie]     [IETF Announce]     [Security]     [Font Config]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux Kernel]

  Powered by Linux