From 7f06c20a97bbfc3e3dbf528180e9ad4fe7bf7964 Mon Sep 17 00:00:00 2001 From: markster Date: Tue, 6 Nov 2001 17:34:13 +0000 Subject: Version 0.1.10 from FTP git-svn-id: http://svn.digium.com/svn/asterisk/trunk@385 f38db490-d61c-443f-a65b-d21fe96a405b --- include/asterisk/sched.h | 47 +++++++++++++++++++++++++++++++++++++---------- 1 file changed, 37 insertions(+), 10 deletions(-) (limited to 'include/asterisk/sched.h') diff --git a/include/asterisk/sched.h b/include/asterisk/sched.h index 9ccdda195..fc8c797b1 100755 --- a/include/asterisk/sched.h +++ b/include/asterisk/sched.h @@ -18,23 +18,34 @@ extern "C" { #endif -/* +//! Max num of schedule structs +/*! * 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) */ - #define SCHED_MAX_CACHE 128 struct sched_context; -/* Create a scheduling context */ +//! New schedule context +/* ! + * Create a scheduling context + * Returns a malloc'd sched_context structure, NULL on failure + */ extern struct sched_context *sched_context_create(void); -void sched_context_destroy(struct sched_context *); +//! destroys a schedule context +/*! + * \param c Context to free + * Destroys (free's) the given sched_context structure + * Returns 0 on success, -1 on failure + */ +void sched_context_destroy(struct sched_context *c); -/* +//! callback for a cheops scheduler +/*! * 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 @@ -42,20 +53,32 @@ void sched_context_destroy(struct sched_context *); typedef int (*ast_sched_cb)(void *data); #define AST_SCHED_CB(a) ((ast_sched_cb)(a)) -/* +//!Adds a scheduled event +/*! + * \param con Schduler context to add + * \param when how many milliseconds to wait for event to occur + * \param callback function to call when the amount of time expires + * \param 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) + * Returns 0 on success, -1 on failure */ extern int ast_sched_add(struct sched_context *con, int when, ast_sched_cb callback, void *data); -/* +//! Deletes a scheduled event +/*! + * \param con scheduling context to delete item from + * \param 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 */ extern int ast_sched_del(struct sched_context *con, int id); -/* +//! Determines number of seconds until the next outstanding event to take place +/*! + * \param 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 @@ -64,13 +87,17 @@ extern int ast_sched_del(struct sched_context *con, int id); */ extern int ast_sched_wait(struct sched_context *con); -/* +//! Runs the queue +/*! + * \param 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. */ extern int ast_sched_runq(struct sched_context *con); -/* +//!Dumps the scheduler contents +/*! + * \param con Context to dump * Debugging: Dump the contents of the scheduler to stderr */ extern void ast_sched_dump(struct sched_context *con); -- cgit v1.2.3