version 1.2.2.1, 2011/10/04 13:29:00
|
version 1.2.2.2, 2011/10/04 13:50:05
|
Line 184 sched_hook_read(void *task, void *arg __unused)
|
Line 184 sched_hook_read(void *task, void *arg __unused)
|
if (kevent(t->task_root->root_kq, chg, 1, NULL, 0, &timeout) == -1) { |
if (kevent(t->task_root->root_kq, chg, 1, NULL, 0, &timeout) == -1) { |
if (t->task_root->root_hooks.hook_exec.exception) |
if (t->task_root->root_hooks.hook_exec.exception) |
t->task_root->root_hooks.hook_exec.exception(t->task_root, NULL); |
t->task_root->root_hooks.hook_exec.exception(t->task_root, NULL); |
|
else |
|
LOGERR; |
return (void*) -1; |
return (void*) -1; |
} |
} |
|
|
Line 222 sched_hook_write(void *task, void *arg __unused)
|
Line 224 sched_hook_write(void *task, void *arg __unused)
|
if (kevent(t->task_root->root_kq, chg, 1, NULL, 0, &timeout) == -1) { |
if (kevent(t->task_root->root_kq, chg, 1, NULL, 0, &timeout) == -1) { |
if (t->task_root->root_hooks.hook_exec.exception) |
if (t->task_root->root_hooks.hook_exec.exception) |
t->task_root->root_hooks.hook_exec.exception(t->task_root, NULL); |
t->task_root->root_hooks.hook_exec.exception(t->task_root, NULL); |
|
else |
|
LOGERR; |
return (void*) -1; |
return (void*) -1; |
} |
} |
|
|
Line 310 retry:
|
Line 314 retry:
|
} else /* wait INFTIM */ |
} else /* wait INFTIM */ |
timeout = NULL; |
timeout = NULL; |
if ((en = kevent(r->root_kq, NULL, 0, res, KQ_EVENTS, timeout)) == -1) { |
if ((en = kevent(r->root_kq, NULL, 0, res, KQ_EVENTS, timeout)) == -1) { |
if (r->root_hooks.hook_exec.exception) | if (r->root_hooks.hook_exec.exception) { |
if (r->root_hooks.hook_exec.exception(r, NULL)) |
if (r->root_hooks.hook_exec.exception(r, NULL)) |
return NULL; /* exit from scheduler */ |
return NULL; /* exit from scheduler */ |
|
} else |
|
LOGERR; |
#ifdef NDEBUG |
#ifdef NDEBUG |
/* kevent no exit by error, if non-debug version */ |
/* kevent no exit by error, if non-debug version */ |
goto retry; |
goto retry; |
Line 378 retry:
|
Line 384 retry:
|
} |
} |
break; |
break; |
} |
} |
if (kevent(r->root_kq, evt, 1, NULL, 0, &nw) == -1) | if (kevent(r->root_kq, evt, 1, NULL, 0, &nw) == -1) { |
if (r->root_hooks.hook_exec.exception) | if (r->root_hooks.hook_exec.exception) { |
if (r->root_hooks.hook_exec.exception(r, NULL)) |
if (r->root_hooks.hook_exec.exception(r, NULL)) |
return NULL; /* exit from scheduler */ |
return NULL; /* exit from scheduler */ |
|
} else |
|
LOGERR; |
|
} |
} |
} |
|
|
/* timer update & put in ready queue */ |
/* timer update & put in ready queue */ |
Line 422 retry:
|
Line 431 retry:
|
/* |
/* |
* sched_hook_exception() - Default EXCEPTION hook |
* sched_hook_exception() - Default EXCEPTION hook |
* @root = root task |
* @root = root task |
* @arg = may be EV_EOF | * @arg = custom handling: if arg == EV_EOF or other value; default: arg == NULL log errno |
* return: <0 errors and 0 ok |
* return: <0 errors and 0 ok |
*/ |
*/ |
void * |
void * |
Line 433 sched_hook_exception(void *root, void *arg)
|
Line 442 sched_hook_exception(void *root, void *arg)
|
if (!r || !ROOT_DATA(r) || !ROOT_DATLEN(r)) |
if (!r || !ROOT_DATA(r) || !ROOT_DATLEN(r)) |
return NULL; |
return NULL; |
|
|
|
/* custom exception handling ... */ |
if (arg) { |
if (arg) { |
if (arg == (void*) EV_EOF) |
if (arg == (void*) EV_EOF) |
return NULL; |
return NULL; |
return (void*) -1; /* raise error */ | return (void*) -1; /* raise scheduler error!!! */ |
} else | } |
LOGERR; | |
|
|
if (errno == EINTR) | /* if error hook exists */ |
return (void*) -1; /* raise error */ | if (r->root_hooks.hook_root.error) |
| return (r->root_hooks.hook_root.error(root, (void*) errno)); |
|
|
|
/* default case! */ |
|
LOGERR; |
return NULL; |
return NULL; |
} |
} |