EXTERNAL / PUBLIC. More...
Functions | |
dessert_periodic_t * | dessert_periodic_add (dessert_periodiccallback_t *c, void *data, const struct timeval *scheduled, const struct timeval *interval) |
Adds a delayed/periodic task to the task list. | |
dessert_periodic_t * | dessert_periodic_add_delayed (dessert_periodiccallback_t *c, void *data, int delay) |
Adds a delayed task to the task list. | |
int | dessert_periodic_del (dessert_periodic_t *p) |
Removes a delayed/periodic task from the task list. |
EXTERNAL / PUBLIC.
dessert_periodic_t* dessert_periodic_add | ( | dessert_periodiccallback_t * | c, | |
void * | data, | |||
const struct timeval * | scheduled, | |||
const struct timeval * | interval | |||
) |
Adds a delayed/periodic task to the task list.
[in] | c | callback to call when task is scheduled |
[in] | data | data to give to the callback |
[in] | scheduled | when should the callback be called the first time |
[in] | interval | how often should it be called (set to NULL if only once) |
pointer | if the callback was added successfully | |
NULL | otherwise |
tv_usec
member of the struct
timeval:
This is the rest of the elapsed time (a fraction of a second), represented as the number of microseconds. It is always less than one million. So, to make sure this invariant is always met, consider using the provided TIMEVAL_ADD() macro.struct timeval interval; interval.tv_sec = 1; interval.tv_usec = 500000; struct timeval schedule; gettimeofday(&schedule, NULL); TIMEVAL_ADD(&schedule, 1, 500000); dessert_periodic_add(callback, NULL, &schedule, &interval);
dessert_periodic_t* dessert_periodic_add_delayed | ( | dessert_periodiccallback_t * | c, | |
void * | data, | |||
int | delay | |||
) |
Adds a delayed task to the task list.
This is an easier version of dessert_periodic_add() taking a single delay as parameter.
[in] | c | callback to call when task is scheduled |
[in] | data | data to give to the callback |
[in] | delay | the delay in seconds |
DESCRIPTION:
int dessert_periodic_del | ( | dessert_periodic_t * | p | ) |
Removes a delayed/periodic task from the task list.
[in] | p | pointer to task description |
DESCRIPTION: