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

Re: XtAppAddInput and XtAppAddTimeOut



Quoting Ron Stanonik:
> Alas, the
> callbacks I registered using XtAppAddInput and XtAppAddTimeOut (with context
> wxAPP_CONTEXT) aren't getting called back from mred.  Searching through
> mred/wxwindows I haven't found a typical Xt event loop (XtAppProcessEvent or
> XtAppNextEvent/XtDispatchEvent).  What I need are callbacks on file
> discripters and timeouts.  Should I be using something other than XtAppAdd?

MrEd doesn't work with XtAppAddInput and XtAppAddTimeOut because it
manages "sleeping" (blocked on input) directly with select()... which
is because MrEd doesn't use XtAppNextEvent()... which is because MrEd
pulls events selectively from the queue to implement eventspaces.


For timeouts, you could instantiate timer%. (Or, if you can get to wxAPP_CONTEXT, then maybe you can also get to 
  long wxAppAddTimeOut(XtAppContext, unsigned long interval, 
		       XtTimerCallbackProc callback, XtPointer data)
and
  void wxRemoveTimeOut(long timer)
which are defined in mredx.cxx.
)


For file descriptors, you could use a Scheme thread that blocks on the
descriptor with scheme_block_until().


There are lots of threading issues here. Note that instantiating timer%
(or using wxAppAddTimeOut) creates a callback in the current
eventspace. Meanwhile, any other events you get through wxAPP_CONTEXT
are coming from a thread/eventspace that Scheme code isn't supposed to
see, and that normally just hands out events to other eventspaces.

Matthew