mirror of
https://github.com/oliverschmidt/contiki.git
synced 2024-12-22 10:30:13 +00:00
Merge pull request #862 from tadodotcom/ctimer-set-process
feat(ctimer): API extension to explictly state the process a ctimer belongs to
This commit is contained in:
commit
023deaf49f
@ -98,9 +98,16 @@ ctimer_init(void)
|
||||
void
|
||||
ctimer_set(struct ctimer *c, clock_time_t t,
|
||||
void (*f)(void *), void *ptr)
|
||||
{
|
||||
ctimer_set_with_process(c, t, f, ptr, PROCESS_CURRENT());
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
void
|
||||
ctimer_set_with_process(struct ctimer *c, clock_time_t t,
|
||||
void (*f)(void *), void *ptr, struct process *p)
|
||||
{
|
||||
PRINTF("ctimer_set %p %u\n", c, (unsigned)t);
|
||||
c->p = PROCESS_CURRENT();
|
||||
c->p = p;
|
||||
c->f = f;
|
||||
c->ptr = ptr;
|
||||
if(initialized) {
|
||||
|
@ -109,10 +109,28 @@ void ctimer_restart(struct ctimer *c);
|
||||
* sometime in the future. When the callback timer expires,
|
||||
* the callback function f will be called with ptr as argument.
|
||||
*
|
||||
* This essentially does ctimer_set_process(c, t, f, ptr, PROCESS_CURRENT());
|
||||
*
|
||||
*/
|
||||
void ctimer_set(struct ctimer *c, clock_time_t t,
|
||||
void (*f)(void *), void *ptr);
|
||||
|
||||
/**
|
||||
* \brief Set a callback timer.
|
||||
* \param c A pointer to the callback timer.
|
||||
* \param t The interval before the timer expires.
|
||||
* \param f A function to be called when the timer expires.
|
||||
* \param ptr An opaque pointer that will be supplied as an argument to the callback function.
|
||||
* \param p A pointer to the process the timer belongs to
|
||||
*
|
||||
* This function is used to set a callback timer for a time
|
||||
* sometime in the future. When the callback timer expires,
|
||||
* the callback function f will be called with ptr as argument.
|
||||
*
|
||||
*/
|
||||
void ctimer_set_with_process(struct ctimer *c, clock_time_t t,
|
||||
void (*f)(void *), void *ptr, struct process *p);
|
||||
|
||||
/**
|
||||
* \brief Stop a pending callback timer.
|
||||
* \param c A pointer to the pending callback timer.
|
||||
|
Loading…
Reference in New Issue
Block a user