RGtk2 (version 2.20.31)

GMainLoop: The GLib Main Loop

Description

GLib provides an event-loop to all GLib-based libraries and applications. RGtk2 is one such library.

Usage

gTimeoutAdd(interval, f, data = NULL) gIdleAdd(f, data = NULL) gSourceRemove(id)

Arguments

interval
The time interval which determines the frequency of the handler call
f
An R function that is called by the loop
data
Any R object that is passed to the R function as the last parameter
id
The source id obtained when adding a handler

Value

gIdleAdd and gTimeoutAdd both return a source id that may be used to remove the handler later.

Details

The RGtk2 user has limited control over the event loop, but it still possible to register handlers as either timeout or idle tasks. A handler may be any R function, though it must return TRUE as long as it wants to stay connected to the loop.

Timeout tasks are performed once per some specified interval of time. Use gTimeoutAdd to register such a handler.

When the event loop is idle (not busy) it will execute the idle handlers, which may be registered with gIdleAdd.

If one needs to externally remove a handler from the loop, gSourceRemove will serve this purpose.

References

http://developer.gnome.org/doc/API/2.0/glib/glib-The-Main-Event-Loop.html