--- libaitsched/src/hooks.c 2014/01/28 10:07:06 1.24.4.3 +++ libaitsched/src/hooks.c 2014/01/28 12:14:20 1.24.4.6 @@ -3,7 +3,7 @@ * by Michael Pounov * * $Author: misho $ -* $Id: hooks.c,v 1.24.4.3 2014/01/28 10:07:06 misho Exp $ +* $Id: hooks.c,v 1.24.4.6 2014/01/28 12:14:20 misho Exp $ * ************************************************************************** The ELWIX and AITNET software is distributed under the following @@ -562,7 +562,24 @@ sched_hook_signal(void *task, void *arg __unused) LOGERR; return (void*) -1; } +#else +#if 0 + sched_task_t *t = task; + struct sigaction sa; + memset(&sa, 0, sizeof sa); + sigemptyset(&sa.sa_mask); + sa.sa_handler = _sched_sigHandler; + sa.sa_flags = SA_RESETHAND | SA_RESTART; + + if (sigaction(TASK_VAL(t), &sa, NULL) == -1) { + if (TASK_ROOT(t)->root_hooks.hook_exec.exception) + TASK_ROOT(t)->root_hooks.hook_exec.exception(TASK_ROOT(t), NULL); + else + LOGERR; + return (void*) -1; + } +#endif /* 0 */ #endif return NULL; } @@ -1231,6 +1248,13 @@ sched_hook_fetch(void *root, void *arg __unused) FD_CLR(i, &r->root_fds[1]); } } + + /* optimize select */ + for (i = r->root_kq - 1; i > 2; i--) + if (FD_ISSET(i, &r->root_fds[0]) || FD_ISSET(i, &r->root_fds[1])) + break; + if (i > 2) + r->root_kq = i + 1; #endif /* KQ_DISABLE */ skip_event: