Portable ThreadsAdditional GBBopen ToolsPolling FunctionsScheduled and Periodic FunctionsGoTo Top

Scheduled and Periodic Functions

GBBopen provides two forms of time-scheduled functions: scheduled functions and periodic functions, both built using Portable Threads. These time-scheduled-function entities are provided by the :portable-threads module.

Scheduled Functions

A scheduled function is an object that contains a function to be run at a specified time. When that specified time arrives, the function is invoked with a single argument: the scheduled function object. A repeat interval (in seconds) can also be specified for the scheduled function. This value is used whenever the scheduled function is invoked to schedule itself again at a new time relative to the current invocation. Scheduled functions can be scheduled to a resolution of one second.

Scheduled functions are scheduled and invoked by a separate "Scheduled-Function Scheduler" thread. Unless the run time of the invoked function is brief, the invoked function should spawn a new thread in which to perform its activities so as to avoid delaying the invocation of a subsequent scheduled function.

Periodic Functions

A periodic function is a function to be run repeatedly at a specified interval. Unlike scheduled functions, which can be scheduled only to a resolution of one second, a periodic function can be repeated at intervals as brief as is supported by the sleep function of the Common Lisp implementation. A periodic function is scheduled and executed in its own thread. As with scheduled functions, the invoked function should spawn a new thread in which to perform its activities, unless its run time is brief.

Entities


The GBBopen Project


Portable ThreadsAdditional GBBopen ToolsPolling FunctionsScheduled and Periodic FunctionsGoTo Top