|
|
| version 1.5.2.2, 2012/05/03 15:05:09 | version 1.6, 2012/05/14 12:09:13 |
|---|---|
| Line 212 void * | Line 212 void * |
| sched_hook_fetch(void *root, void *arg __unused) | sched_hook_fetch(void *root, void *arg __unused) |
| { | { |
| sched_root_task_t *r = root; | sched_root_task_t *r = root; |
| sched_task_t *task; | sched_task_t *task, *tmp; |
| struct timespec now, m, mtmp; | struct timespec now, m, mtmp; |
| struct timespec *timeout; | struct timespec *timeout; |
| struct kevent evt[1], res[KQ_EVENTS]; | struct kevent evt[1], res[KQ_EVENTS]; |
| Line 223 sched_hook_fetch(void *root, void *arg __unused) | Line 223 sched_hook_fetch(void *root, void *arg __unused) |
| return NULL; | return NULL; |
| /* get new task by queue priority */ | /* get new task by queue priority */ |
| retry: | |
| while ((task = TAILQ_FIRST(&r->root_event))) { | while ((task = TAILQ_FIRST(&r->root_event))) { |
| #ifdef HAVE_LIBPTHREAD | #ifdef HAVE_LIBPTHREAD |
| pthread_mutex_lock(&r->root_mtx[taskEVENT]); | pthread_mutex_lock(&r->root_mtx[taskEVENT]); |
| Line 306 retry: | Line 305 retry: |
| 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; | return NULL; |
| } else | } else if (errno != EINTR) |
| LOGERR; | LOGERR; |
| #ifdef NDEBUG | |
| /* kevent no exit by error, if non-debug version */ | |
| goto retry; | |
| #else | |
| /* diagnostic exit from scheduler if kevent error occur */ | |
| return NULL; | return NULL; |
| #endif | |
| } | } |
| now.tv_sec = now.tv_nsec = 0; | now.tv_sec = now.tv_nsec = 0; |
| Line 325 retry: | Line 318 retry: |
| /* Put read/write task to ready queue */ | /* Put read/write task to ready queue */ |
| switch (res[i].filter) { | switch (res[i].filter) { |
| case EVFILT_READ: | case EVFILT_READ: |
| TAILQ_FOREACH(task, &r->root_read, task_node) { | TAILQ_FOREACH_SAFE(task, &r->root_read, task_node, tmp) { |
| if (TASK_FD(task) != ((intptr_t) res[i].udata)) | if (TASK_FD(task) != ((intptr_t) res[i].udata)) |
| continue; | continue; |
| /* remove read handle */ | /* remove read handle */ |
| Line 370 retry: | Line 363 retry: |
| } | } |
| break; | break; |
| case EVFILT_WRITE: | case EVFILT_WRITE: |
| TAILQ_FOREACH(task, &r->root_write, task_node) { | TAILQ_FOREACH_SAFE(task, &r->root_write, task_node, tmp) { |
| if (TASK_FD(task) != ((intptr_t) res[i].udata)) | if (TASK_FD(task) != ((intptr_t) res[i].udata)) |
| continue; | continue; |
| /* remove write handle */ | /* remove write handle */ |
| Line 427 retry: | Line 420 retry: |
| /* timer update & put in ready queue */ | /* timer update & put in ready queue */ |
| clock_gettime(CLOCK_MONOTONIC, &now); | clock_gettime(CLOCK_MONOTONIC, &now); |
| TAILQ_FOREACH(task, &r->root_timer, task_node) | TAILQ_FOREACH_SAFE(task, &r->root_timer, task_node, tmp) |
| if (sched_timespeccmp(&now, &TASK_TS(task), -) >= 0) { | if (sched_timespeccmp(&now, &TASK_TS(task), -) >= 0) { |
| #ifdef HAVE_LIBPTHREAD | #ifdef HAVE_LIBPTHREAD |
| pthread_mutex_lock(&r->root_mtx[taskTIMER]); | pthread_mutex_lock(&r->root_mtx[taskTIMER]); |