Sat Apr 26 20:55:08 2008

Asterisk developer's documentation


sched.h File Reference

Scheduler Routines (derived from cheops). More...

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Defines

#define ast_sched_add_object(obj, con, when, callback)   ast_sched_add((con),(when),(callback), ASTOBJ_REF((obj)))
#define AST_SCHED_CB(a)   ((ast_sched_cb)(a))
#define ast_sched_del_object(obj, destructor, con, id)
#define SCHED_MAX_CACHE   128

Typedefs

typedef int(*) ast_sched_cb (void *data)

Functions

int ast_sched_add (struct sched_context *con, int when, ast_sched_cb callback, void *data)
int ast_sched_add_variable (struct sched_context *con, int when, ast_sched_cb callback, void *data, int variable)
int ast_sched_del (struct sched_context *con, int id)
void ast_sched_dump (const struct sched_context *con)
int ast_sched_runq (struct sched_context *con)
int ast_sched_wait (struct sched_context *con)
long ast_sched_when (struct sched_context *con, int id)
sched_context * sched_context_create (void)
void sched_context_destroy (struct sched_context *c)


Detailed Description

Scheduler Routines (derived from cheops).

Definition in file sched.h.


Define Documentation

#define SCHED_MAX_CACHE   128

The max number of schedule structs to keep around for use. Undefine to disable schedule structure caching. (Only disable this on very low memory machines)

Definition at line 37 of file sched.h.


Typedef Documentation

typedef int(*) ast_sched_cb(void *data)

A cheops scheduler callback takes a pointer with callback data and returns a 0 if it should not be run again, or non-zero if it should be rescheduled to run again

Definition at line 62 of file sched.h.


Function Documentation

int ast_sched_add ( struct sched_context *  con,
int  when,
ast_sched_cb  callback,
void *  data 
)

Parameters:
con Scheduler context to add
when how many milliseconds to wait for event to occur
callback function to call when the amount of time expires
data data to pass to the callback Schedule an event to take place at some point in the future. callback will be called with data as the argument, when milliseconds into the future (approximately) If callback returns 0, no further events will be re-scheduled Returns a schedule item ID on success, -1 on failure

int ast_sched_add_variable ( struct sched_context *  con,
int  when,
ast_sched_cb  callback,
void *  data,
int  variable 
)

Parameters:
con Scheduler context to add
when how many milliseconds to wait for event to occur
callback function to call when the amount of time expires
data data to pass to the callback
variable If true, the result value of callback function will be used for rescheduling Schedule an event to take place at some point in the future. callback will be called with data as the argument, when milliseconds into the future (approximately) If callback returns 0, no further events will be re-scheduled Returns a schedule item ID on success, -1 on failure

int ast_sched_del ( struct sched_context *  con,
int  id 
)

Parameters:
con scheduling context to delete item from
id ID of the scheduled item to delete Remove this event from being run. A procedure should not remove its own event, but return 0 instead. Returns 0 on success, -1 on failure

void ast_sched_dump ( const struct sched_context *  con  ) 

Parameters:
con Context to dump Debugging: Dump the contents of the scheduler to stderr

int ast_sched_runq ( struct sched_context *  con  ) 

Parameters:
con Scheduling context to run Run the queue, executing all callbacks which need to be performed at this time. Returns the number of events processed.

int ast_sched_wait ( struct sched_context *  con  ) 

Parameters:
con context to act upon Determine the number of seconds until the next outstanding event should take place, and return the number of milliseconds until it needs to be run. This value is perfect for passing to the poll call. Returns "-1" if there is nothing there are no scheduled events (and thus the poll should not timeout)

long ast_sched_when ( struct sched_context *  con,
int  id 
)

Parameters:
con Context to use
id Id to dump

struct sched_context* sched_context_create ( void   ) 

New schedule context

void sched_context_destroy ( struct sched_context *  c  ) 

Parameters:
c Context to free Destroys (free's) the given sched_context structure Returns 0 on success, -1 on failure


Generated on Sat Apr 26 20:55:09 2008 for Asterisk - the Open Source PBX by  doxygen 1.5.1