version 1.24.4.2, 2014/01/27 17:08:02
|
version 1.24.4.3, 2014/01/28 10:07:06
|
Line 750 sched_hook_fetch(void *root, void *arg __unused)
|
Line 750 sched_hook_fetch(void *root, void *arg __unused)
|
/* kevent dispatcher */ |
/* kevent dispatcher */ |
now.tv_sec = now.tv_nsec = 0; |
now.tv_sec = now.tv_nsec = 0; |
/* Go and catch the cat into pipes ... */ |
/* Go and catch the cat into pipes ... */ |
for (i = 0; i < en; i++) { |
|
#ifndef KQ_DISABLE |
#ifndef KQ_DISABLE |
|
for (i = 0; i < en; i++) { |
memcpy(evt, &res[i], sizeof evt); |
memcpy(evt, &res[i], sizeof evt); |
evt->flags = EV_DELETE; |
evt->flags = EV_DELETE; |
/* Put read/write task to ready queue */ |
/* Put read/write task to ready queue */ |
Line 1120 sched_hook_fetch(void *root, void *arg __unused)
|
Line 1120 sched_hook_fetch(void *root, void *arg __unused)
|
} else |
} else |
LOGERR; |
LOGERR; |
} |
} |
|
} |
#else /* end of kevent dispatcher */ |
#else /* end of kevent dispatcher */ |
#endif /* KQ_DISABLE */ | for (i = 0; i < r->root_kq; i++) { |
| if (FD_ISSET(i, &r->root_fds[0])) { |
| flg = 0; |
| TAILQ_FOREACH_SAFE(task, &r->root_read, task_node, tmp) { |
| if (TASK_FD(task) != i) |
| continue; |
| else { |
| flg++; |
| TASK_RET(task) ^= TASK_RET(task); |
| TASK_FLAG(task) ^= TASK_FLAG(task); |
| } |
| /* remove read handle */ |
| #ifdef HAVE_LIBPTHREAD |
| pthread_mutex_lock(&r->root_mtx[taskREAD]); |
| #endif |
| TAILQ_REMOVE(&r->root_read, task, task_node); |
| #ifdef HAVE_LIBPTHREAD |
| pthread_mutex_unlock(&r->root_mtx[taskREAD]); |
| #endif |
| if (r->root_hooks.hook_exec.exception) { |
| if (r->root_hooks.hook_exec.exception(r, NULL)) { |
| task->task_type = taskUNUSE; |
| #ifdef HAVE_LIBPTHREAD |
| pthread_mutex_lock(&r->root_mtx[taskUNUSE]); |
| #endif |
| TAILQ_INSERT_TAIL(&r->root_unuse, task, task_node); |
| #ifdef HAVE_LIBPTHREAD |
| pthread_mutex_unlock(&r->root_mtx[taskUNUSE]); |
| #endif |
| } else { |
| task->task_type = taskREADY; |
| #ifdef HAVE_LIBPTHREAD |
| pthread_mutex_lock(&r->root_mtx[taskREADY]); |
| #endif |
| TAILQ_INSERT_TAIL(&r->root_ready, task, task_node); |
| #ifdef HAVE_LIBPTHREAD |
| pthread_mutex_unlock(&r->root_mtx[taskREADY]); |
| #endif |
| } |
| } else { |
| task->task_type = taskREADY; |
| #ifdef HAVE_LIBPTHREAD |
| pthread_mutex_lock(&r->root_mtx[taskREADY]); |
| #endif |
| TAILQ_INSERT_TAIL(&r->root_ready, task, task_node); |
| #ifdef HAVE_LIBPTHREAD |
| pthread_mutex_unlock(&r->root_mtx[taskREADY]); |
| #endif |
| } |
| } |
| /* if match equal to 1, remove resouce */ |
| if (flg == 1) |
| FD_CLR(i, &r->root_fds[0]); |
| } |
| |
| if (FD_ISSET(i, &r->root_fds[1])) { |
| flg = 0; |
| TAILQ_FOREACH_SAFE(task, &r->root_write, task_node, tmp) { |
| if (TASK_FD(task) != i) |
| continue; |
| else { |
| flg++; |
| TASK_RET(task) ^= TASK_RET(task); |
| TASK_FLAG(task) ^= TASK_FLAG(task); |
| } |
| /* remove write handle */ |
| #ifdef HAVE_LIBPTHREAD |
| pthread_mutex_lock(&r->root_mtx[taskWRITE]); |
| #endif |
| TAILQ_REMOVE(&r->root_write, task, task_node); |
| #ifdef HAVE_LIBPTHREAD |
| pthread_mutex_unlock(&r->root_mtx[taskWRITE]); |
| #endif |
| if (r->root_hooks.hook_exec.exception) { |
| if (r->root_hooks.hook_exec.exception(r, NULL)) { |
| task->task_type = taskUNUSE; |
| #ifdef HAVE_LIBPTHREAD |
| pthread_mutex_lock(&r->root_mtx[taskUNUSE]); |
| #endif |
| TAILQ_INSERT_TAIL(&r->root_unuse, task, task_node); |
| #ifdef HAVE_LIBPTHREAD |
| pthread_mutex_unlock(&r->root_mtx[taskUNUSE]); |
| #endif |
| } else { |
| task->task_type = taskREADY; |
| #ifdef HAVE_LIBPTHREAD |
| pthread_mutex_lock(&r->root_mtx[taskREADY]); |
| #endif |
| TAILQ_INSERT_TAIL(&r->root_ready, task, task_node); |
| #ifdef HAVE_LIBPTHREAD |
| pthread_mutex_unlock(&r->root_mtx[taskREADY]); |
| #endif |
| } |
| } else { |
| task->task_type = taskREADY; |
| #ifdef HAVE_LIBPTHREAD |
| pthread_mutex_lock(&r->root_mtx[taskREADY]); |
| #endif |
| TAILQ_INSERT_TAIL(&r->root_ready, task, task_node); |
| #ifdef HAVE_LIBPTHREAD |
| pthread_mutex_unlock(&r->root_mtx[taskREADY]); |
| #endif |
| } |
| } |
| /* if match equal to 1, remove resouce */ |
| if (flg == 1) |
| FD_CLR(i, &r->root_fds[1]); |
| } |
} |
} |
|
#endif /* KQ_DISABLE */ |
|
|
skip_event: |
skip_event: |
/* timer update & put in ready queue */ |
/* timer update & put in ready queue */ |