--- libaitsched/src/hooks.c 2012/05/30 08:07:45 1.6.4.1 +++ libaitsched/src/hooks.c 2012/05/30 08:34:44 1.6.4.2 @@ -3,7 +3,7 @@ * by Michael Pounov * * $Author: misho $ -* $Id: hooks.c,v 1.6.4.1 2012/05/30 08:07:45 misho Exp $ +* $Id: hooks.c,v 1.6.4.2 2012/05/30 08:34:44 misho Exp $ * ************************************************************************** The ELWIX and AITNET software is distributed under the following @@ -238,9 +238,13 @@ sched_hook_alarm(void *task, void *arg __unused) ident = (uintptr_t) TASK_FUNC(t); #ifdef __NetBSD__ - EV_SET(&chg[0], ident, EVFILT_TIMER, EV_ADD | EV_ONESHOT, 0, 0, (intptr_t) ident); + EV_SET(&chg[0], ident, EVFILT_TIMER, EV_ADD | EV_ONESHOT, 0, + t->task_val.ts.tv_sec * 1000 + t->task_val.ts.tv_nsec / 1000000, + (intptr_t) ident); #else - EV_SET(&chg[0], ident, EVFILT_TIMER, EV_ADD | EV_ONESHOT, 0, 0, (void*) ident); + EV_SET(&chg[0], ident, EVFILT_TIMER, EV_ADD | EV_ONESHOT, 0, + t->task_val.ts.tv_sec * 1000 + t->task_val.ts.tv_nsec / 1000000, + (void*) ident); #endif if (kevent(TASK_ROOT(t)->root_kq, chg, 1, NULL, 0, &timeout) == -1) { if (TASK_ROOT(t)->root_hooks.hook_exec.exception) @@ -461,11 +465,11 @@ sched_hook_fetch(void *root, void *arg __unused) } break; case EVFILT_TIMER: - if (TASK_DATA(task)) - ident = (uintptr_t) TASK_DATA(task); - else - ident = (uintptr_t) TASK_FUNC(task); TAILQ_FOREACH_SAFE(task, &r->root_alarm, task_node, tmp) { + if (TASK_DATA(task)) + ident = (uintptr_t) TASK_DATA(task); + else + ident = (uintptr_t) TASK_FUNC(task); if (ident != ((uintptr_t) res[i].udata)) continue; /* remove alarm handle */