68 while (cur_nscb != NULL) {
73 NSLOG(schedule, DEBUG,
74 "callback entry %p removing %p(%p)",
80 unlnk_nscb = cur_nscb;
81 cur_nscb = unlnk_nscb->
next;
83 if (prev_nscb == NULL) {
86 prev_nscb->
next = cur_nscb;
92 cur_nscb = prev_nscb->
next;
110 tv.tv_sec = ival / 1000;
111 tv.tv_usec = (ival % 1000) * 1000;
118 NSLOG(schedule, DEBUG,
119 "adding callback %p for %p(%p) at %d cs",
120 nscb, callback, p, ival);
122 gettimeofday(&nscb->
tv, NULL);
140 struct timeval nexttime;
141 struct timeval rettime;
152 nexttime = cur_nscb->
tv;
154 gettimeofday(&
tv, NULL);
156 while (cur_nscb != NULL) {
161 unlnk_nscb = cur_nscb;
163 if (prev_nscb == NULL) {
169 NSLOG(schedule, DEBUG,
170 "callback entry %p running %p(%p)",
188 nexttime = cur_nscb->
tv;
194 nexttime = cur_nscb->
tv;
197 prev_nscb = cur_nscb;
198 cur_nscb = prev_nscb->
next;
205 NSLOG(schedule, DEBUG,
206 "returning time to next event as %ldms",
207 (rettime.tv_sec * 1000) + (rettime.tv_usec / 1000));
210 return (rettime.tv_sec * 1000) + (rettime.tv_usec / 1000);
219 gettimeofday(&
tv, NULL);
221 NSLOG(netsurf, INFO,
"schedule list at %ld:%ld",
tv.tv_sec,
tv.tv_usec);
225 while (cur_nscb != NULL) {
227 "Schedule %p at %ld:%ld",
230 cur_nscb->
tv.tv_usec);
231 cur_nscb = cur_nscb->
next;
void list_schedule(void)
LOG all current scheduled events.
int schedule_run(void)
Process events up to current time.
nserror
Enumeration of error codes.
@ NSERROR_NOMEM
Memory exhaustion.
#define NSLOG(catname, level, logmsg, args...)
BSD style timeval macros.
#define timercmp(a, aa, cmp)
#define timeradd(a, aa, result)
#define timersub(a, aa, result)
Interface to time operations.
static struct nscallback * schedule_list
static nserror schedule_remove(void(*callback)(void *p), void *p)
Unschedule a callback.
nserror win32_schedule(int ival, void(*callback)(void *p), void *p)
Schedule a callback.