Hi all,
Question: Can the XtAppProcessEvent() function be called from a
event or timer callback function? I.e., simply put, can
an Xt callback function itself have an event handling loop?
I have an app that has a XtAppMainLoop(), but some of the work in
the callback function could take a long time (i.e., network
I/O, etc). So, is it safe for the callback function itself to do
something like select() on the data being waited on, while itself having
an event loop that looks something like this, so that the app doesn't
appear frozen:
void callback_func(Widget w, XtPointer client_data, XtPointer call_data)
{
/* ... */
do {
FD_ZERO(&efds);
FD_ZERO(&rfds);
FD_SET(fd, &rfds);
to.tv_sec = 0;
to.tv_usec = 50000;
ret = select(fd+1, &rfds, NULL, &efds, &to);
while (XtAppPending(app_context))
XtAppProcessEvent(app_context, XtIMAll);
} while (ret == 0);
/* ... */
}
Sorry about this somewhat off-topic question, but I haven't been able
to get a definitive answer from the various X docs and manuals.
The XtAppProcessEvent man page seems to imply that this is ok, but
it's not clear that the function is actually safe for recursion at
some level.
I tested this and it seems to work, but some users of my app gets
XIO errors and unexpected async reply errors that I could not reproduce.
Hope someone could shed some light on this.
-Ti
_______________________________________________
Lesstif mailing list
[EMAIL PROTECTED]
https://terror.hungry.com/mailman/listinfo/lesstif