version 1.10.2.2, 2012/08/01 14:11:43
|
version 1.10.2.5, 2012/08/01 15:17:38
|
Line 107 sched_hook_cancel(void *task, void *arg __unused)
|
Line 107 sched_hook_cancel(void *task, void *arg __unused)
|
sched_task_t *t = task; |
sched_task_t *t = task; |
struct kevent chg[1]; |
struct kevent chg[1]; |
struct timespec timeout = { 0, 0 }; |
struct timespec timeout = { 0, 0 }; |
|
#ifdef EVFILT_AIO |
|
struct aiocb *acb; |
|
#endif |
|
|
if (!t || !TASK_ROOT(t)) |
if (!t || !TASK_ROOT(t)) |
return (void*) -1; |
return (void*) -1; |
Line 163 sched_hook_cancel(void *task, void *arg __unused)
|
Line 166 sched_hook_cancel(void *task, void *arg __unused)
|
#else |
#else |
EV_SET(&chg[0], TASK_VAL(t), EVFILT_AIO, EV_DELETE, 0, 0, (void*) TASK_VAL(t)); |
EV_SET(&chg[0], TASK_VAL(t), EVFILT_AIO, EV_DELETE, 0, 0, (void*) TASK_VAL(t)); |
#endif |
#endif |
if (TASK_VAL(t)) { | acb = (struct aiocb*) TASK_VAL(t); |
free((void*) TASK_VAL(t)); | if (acb) { |
| aio_cancel(acb->aio_fildes, acb); |
| free(acb); |
TASK_VAL(t) = 0; |
TASK_VAL(t) = 0; |
} |
} |
break; |
break; |
Line 449 sched_hook_fetch(void *root, void *arg __unused)
|
Line 454 sched_hook_fetch(void *root, void *arg __unused)
|
register int i, flg; |
register int i, flg; |
int en; |
int en; |
#ifdef EVFILT_AIO |
#ifdef EVFILT_AIO |
|
int len, fd; |
struct aiocb *acb; |
struct aiocb *acb; |
#endif |
#endif |
|
|
Line 771 sched_hook_fetch(void *root, void *arg __unused)
|
Line 777 sched_hook_fetch(void *root, void *arg __unused)
|
#ifdef EVFILT_AIO |
#ifdef EVFILT_AIO |
case EVFILT_AIO: |
case EVFILT_AIO: |
flg = 0; |
flg = 0; |
acb = (struct aiocb*) TASK_VAL(task); |
|
TAILQ_FOREACH_SAFE(task, &r->root_aio, task_node, tmp) { |
TAILQ_FOREACH_SAFE(task, &r->root_aio, task_node, tmp) { |
|
acb = (struct aiocb*) TASK_VAL(task); |
if (acb != ((struct aiocb*) res[i].ident) || |
if (acb != ((struct aiocb*) res[i].ident) || |
acb->aio_sigevent.sigev_value.sival_ptr != res[i].udata) |
acb->aio_sigevent.sigev_value.sival_ptr != res[i].udata) |
continue; |
continue; |
Line 794 sched_hook_fetch(void *root, void *arg __unused)
|
Line 800 sched_hook_fetch(void *root, void *arg __unused)
|
#ifdef HAVE_LIBPTHREAD |
#ifdef HAVE_LIBPTHREAD |
pthread_mutex_unlock(&r->root_mtx[taskREADY]); |
pthread_mutex_unlock(&r->root_mtx[taskREADY]); |
#endif |
#endif |
|
fd = acb->aio_fildes; |
|
if ((len = aio_return(acb)) != -1) { |
|
if (lseek(fd, acb->aio_offset + len, SEEK_CUR) == -1) |
|
LOGERR; |
|
} else |
|
LOGERR; |
|
|
|
free(acb); |
|
TASK_FD(task) = (u_long) fd; |
|
TASK_DATLEN(task) = (u_long) len; |
} |
} |
/* if match at least 2, don't remove resouce of event */ |
/* if match at least 2, don't remove resouce of event */ |
if (flg > 1) |
if (flg > 1) |