#include <Reventloop.h>
Data Fields | |
| char * | name |
| void(* | init )(int *argc, char ***argv) |
| void(* | exit )() |
| void(* | main )(void) |
| int(* | nonBlockingIteration )() |
| void(* | quit )() |
| SEXP(* | addInput )(int fd, void(*handler)(void *, int, int), void *userData) |
| SEXP(* | addIdle )(R_IdleFunc, void *userData) |
| SEXP(* | addTimer )(int interval, R_TimerFunc, void *userData) |
| int(* | removeInput )(SEXP) |
| int(* | removeIdle )(SEXP) |
| int(* | removeTimer )(SEXP) |
| void * | data |
| R_EventLoop * | next |
| R_EventLoop * | prev |
We can maintain a linked list of these event loop structures.
What about releasing user-level data objects?
|
|
register a C routine that is to be invoked whenever there are no events pending and the event loop has "nothing" to do. These are essentially background events that should return control very rapidly. S functions can be used by specifying a suitable handler that treates the userData argument as an S function and invokes it. |
|
|
register an input source (identified by its file descriptor) and an event handler for it which is called any time there is input detected on it. The userData field allow one to specify arbitrary data that is passed to the handler when it is called and used to parameterize the actions of that handler. S functions can be used by specifying a suitable handler that treates the userData argument as an S function and invokes it. |
|
|
register a C routine that is to be called after interval milli-seconds. These are timed actions. The userData argument is passed to the routine when it is invoked and used to parameterize its actions. |
|
|
a field for storing data used by the event loop to perform its duties. This can be used in a total event-loop implementation specific manner. Unfortunately, without C++ classes, it is hard to get at this variable without assuming it is in the active event loop (R_eloop). This does allow us to place instance-specific data within each instance of the same event loop structure. For example, if we have two copies of the Tcl event loop, we can store different data there. As each one is made the active event loop, the methods can find their specific instance of the data. If we wanted to make the data available to the methods without assuming the event loop is the active one, we need to add an argument to each method. This may be important if we want to run an event loop as a sub-event loop (e.g. nest Gtk inside Tcl) using these structures and not swap it onto the R_eloop variable. |
|
|
called when the event loop is terminated. This is the parallel function to init |
|
|
a routine that is called each time the event loop is started. It can be used to initialize a toolkit; perform initialization for running the event loop such as maintaining a stack of active instances. |
|
|
the method to run the endless event loop that must be explicitly terminated by calling quit or exiting the process. |
|
|
a simple, user-comprehensible name for this event loop. |
|
|
the next event loop in the linked list/stack. This is different from a nested event loop call which is handled by the C stack, not this stack. |
|
|
the method for processing a single event from this event source without blocking if there is no event on the queue. |
|
|
the previous event loop structure in the linked list of event structures maintained by R. |
|
|
terminate the event loop. See main |
|
|
unregister a idle/background routine This takes the object returned by addIdle to identify the particular. |
|
|
unregister a handler for an input source. This takes the object returned by addInput |
|
|
unregister a timer action routine |
1.2.14 written by Dimitri van Heesch,
© 1997-2002