48 #include "contiki-conf.h"
53 static struct etimer *timerlist;
54 static clock_time_t next_expiration;
56 PROCESS(etimer_process,
"Event timer");
65 if (timerlist ==
NULL) {
71 tdist = t->timer.start + t->timer.interval - now;
72 for(t = t->next; t !=
NULL; t = t->next) {
73 if(t->timer.start + t->timer.interval - now < tdist) {
74 tdist = t->timer.start + t->timer.interval - now;
77 next_expiration = now + tdist;
92 if(ev == PROCESS_EVENT_EXITED) {
93 struct process *p = data;
95 while(timerlist !=
NULL && timerlist->p == p) {
96 timerlist = timerlist->next;
99 if(timerlist !=
NULL) {
101 while(t->next !=
NULL) {
102 if(t->next->p == p) {
103 t->next = t->next->next;
109 }
else if(ev != PROCESS_EVENT_POLL) {
117 for(t = timerlist; t !=
NULL; t = t->next) {
158 if(timer->p != PROCESS_NONE) {
161 for(t = timerlist; t !=
NULL; t = t->next) {
171 timer->next = timerlist;
201 et->timer.start += timediff;
208 return et->p == PROCESS_NONE;
214 return et->timer.start + et->timer.interval;
220 return et->timer.start;
226 return timerlist !=
NULL;
241 if(et == timerlist) {
242 timerlist = timerlist->next;
247 for(t = timerlist; t !=
NULL && t->next != et; t = t->next);
262 et->p = PROCESS_NONE;