Scheduler

Name

Scheduler -- Scheduling facility

Synopsis


gint        sched_init                      (void);
gpointer    sched_event                     (gint sched_time,
                                             sched_callback_t func,
                                             gpointer data,
                                             gint flags);
gpointer    sched_delay                     (gint delay,
                                             sched_callback_t func,
                                             gpointer data,
                                             gint flags);
void        (*sched_callback_t)             (gint time,
                                             gpointer data);
enum        sched_flags_t;

Description

This facility allows the code to do things at certain times without having to handle and count all the clock's TICK events.

Details

sched_init ()

gint        sched_init                      (void);

Initializes the scheduling facility. Mainly registering a callback for the clock subsystem.

Returns : nothing interesting.


sched_event ()

gpointer    sched_event                     (gint sched_time,
                                             sched_callback_t func,
                                             gpointer data,
                                             gint flags);

Function func will be called at time sched_time with arguments sched_time and data.

sched_time : absolute time as seen by the clock subsystem.
func : function to be called when the time comes.
data : will be used as the second argument to func.
flags : can be FREE_SCHED_DATA from sched_flags_t.
Returns : a pointer which is now useless from outsite but in the future may allow for an event to be modified or canceled.


sched_delay ()

gpointer    sched_delay                     (gint delay,
                                             sched_callback_t func,
                                             gpointer data,
                                             gint flags);

function func will be called within delay time units with the current time as first argument and data as the second.

delay : relative time from now.
func : function to be called when the time comes.
data : will be used as the second argument to func.
flags : can be FREE_SCHED_DATA and SCHED_RELOAD from sched_flags_t.
Returns : a pointer which is now useless from outsite but in the future may allow for an event to be modified or canceled.


sched_callback_t ()

void        (*sched_callback_t)             (gint time,
                                             gpointer data);

Funtion pointer type for the callbacks used in the sched facility.

time :current time.
data :data pointer specified when requesting the event.


enum sched_flags_t

typedef enum {
	FREE_SCHED_DATA	= 1<<0, /* The data pointer will be used
				 * as argument to g_free() when done*/

	SCHED_RELOAD	= 1<<1  /* The callback will be called every "delay"
				 * time units */
} sched_flags_t;

Flags for the scheduling facility