65 while (cur_nscb != NULL) {
70 NSLOG(schedule, DEBUG,
71 "callback entry %p removing %p(%p)",
72 cur_nscb, cur_nscb->
callback, cur_nscb->
p);
75 unlnk_nscb = cur_nscb;
76 cur_nscb = unlnk_nscb->
next;
78 if (prev_nscb == NULL) {
81 prev_nscb->
next = cur_nscb;
87 cur_nscb = prev_nscb->
next;
107 NSLOG(schedule, DEBUG,
"Adding %p(%p) in %d", callback, p, tival);
109 tv.tv_sec = tival / 1000;
110 tv.tv_usec = (tival % 1000) * 1000;
114 gettimeofday(&nscb->
tv, NULL);
131 struct timeval nexttime;
132 struct timeval rettime;
143 nexttime = cur_nscb->
tv;
145 gettimeofday(&
tv, NULL);
147 while (cur_nscb != NULL) {
152 unlnk_nscb = cur_nscb;
154 if (prev_nscb == NULL) {
171 nexttime = cur_nscb->
tv;
177 nexttime = cur_nscb->
tv;
180 prev_nscb = cur_nscb;
181 cur_nscb = prev_nscb->
next;
188 NSLOG(schedule, DEBUG,
189 "returning time to next event as %ldms",
190 (rettime.tv_sec * 1000) + (rettime.tv_usec / 1000));
193 return (rettime.tv_sec * 1000) + (rettime.tv_usec / 1000);
201 gettimeofday(&
tv, NULL);
203 NSLOG(netsurf, INFO,
"schedule list at %ld:%ld",
tv.tv_sec,
208 while (cur_nscb != NULL) {
209 NSLOG(netsurf, INFO,
"Schedule %p at %ld:%ld", cur_nscb,
210 cur_nscb->
tv.tv_sec, cur_nscb->
tv.tv_usec);
211 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.
static struct nscallback * schedule_list
static nserror schedule_remove(void(*callback)(void *p), void *p)
Unschedule a callback.
nserror framebuffer_schedule(int tival, void(*callback)(void *p), void *p)
Schedule a callback.
#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.