+/* $NetBSD: schedule.c,v 1.4 2006/09/09 16:22:10 manu Exp $ */
+
/* $KAME: schedule.c,v 1.19 2001/11/05 10:53:19 sakane Exp $ */
/*
#include "var.h"
#include "gcmalloc.h"
+#if !defined(__LP64__)
+// year 2038 problem and fix for 32-bit only
#define FIXY2038PROBLEM
+#endif
#ifndef TAILQ_FOREACH
#define TAILQ_FOREACH(elm, head, field) \
for (elm = TAILQ_FIRST(head); elm; elm = TAILQ_NEXT(elm, field))
#endif
+extern int terminated;
static struct timeval timeout;
#ifdef FIXY2038PROBLEM
now = current_time();
- for (p = TAILQ_FIRST(&sctree); p; p = next) {
+ for (p = TAILQ_FIRST(&sctree); p; p = next) {
/* if the entry has been dead, remove it */
if (p->dead)
goto next_schedule;
/* mark it with dead. and call the function. */
p->dead = 1;
- if (p->func != NULL)
+ if (p->func != NULL && !terminated)
(p->func)(p->param);
next_schedule:
struct scheddump *scbuf, *p;
int len;
sched_dump((caddr_t *)&scbuf, &len);
- if (buf == NULL)
+ if (scbuf == NULL)
return;
for (p = scbuf; len; p++) {
printf("xtime=%ld\n", p->xtime);