67 while (cur_nscb != NULL) {
72 NSLOG(schedule, DEBUG,
"callback entry %p removing %p(%p)",
73 cur_nscb, cur_nscb->
callback, cur_nscb->
p);
76 unlnk_nscb = cur_nscb;
77 cur_nscb = unlnk_nscb->
next;
79 if (prev_nscb == NULL) {
82 prev_nscb->
next = cur_nscb;
89 cur_nscb = prev_nscb->
next;
93 if (removed ==
false) {
112 NSLOG(schedule, DEBUG,
"Adding %p(%p) in %d", callback, p, tival);
114 tv.tv_sec = tival / 1000;
115 tv.tv_usec = (tival % 1000) * 1000;
119 gettimeofday(&nscb->
tv, NULL);
136 struct timeval nexttime;
137 struct timeval rettime;
148 nexttime = cur_nscb->
tv;
150 gettimeofday(&
tv, NULL);
152 while (cur_nscb != NULL) {
157 unlnk_nscb = cur_nscb;
159 if (prev_nscb == NULL) {
176 nexttime = cur_nscb->
tv;
182 nexttime = cur_nscb->
tv;
185 prev_nscb = cur_nscb;
186 cur_nscb = prev_nscb->
next;
193 NSLOG(schedule, DEBUG,
"returning time to next event as %ldms",
194 (
long)((rettime.tv_sec * 1000) + (rettime.tv_usec / 1000)));
197 return (rettime.tv_sec * 1000) + (rettime.tv_usec / 1000);
205 gettimeofday(&
tv, NULL);
207 NSLOG(netsurf, INFO,
"schedule list at %lld:%ld",
208 (
long long)
tv.tv_sec,
tv.tv_usec);
212 while (cur_nscb != NULL) {
213 NSLOG(netsurf, INFO,
"Schedule %p at %lld:%ld", cur_nscb,
214 (
long long)cur_nscb->
tv.tv_sec, cur_nscb->
tv.tv_usec);
215 cur_nscb = cur_nscb->
next;
nserror
Enumeration of error codes.
@ NSERROR_NOT_FOUND
Requested item not found.
#define NSLOG(catname, level, logmsg, args...)
static struct nscallback * schedule_list
void monkey_schedule_list(void)
Log a list of all scheduled callbacks.
nserror monkey_schedule(int tival, void(*callback)(void *p), void *p)
Schedule a callback.
int monkey_schedule_run(void)
Process scheduled callbacks up to current time.
static nserror schedule_remove(void(*callback)(void *p), void *p)
Unschedule a callback.
BSD style timeval macros.
#define timercmp(a, aa, cmp)
#define timeradd(a, aa, result)
#define timersub(a, aa, result)
Interface to time operations.