version 1.13.2.1, 2012/08/21 11:07:16
|
version 1.17, 2013/05/30 09:13:52
|
Line 12 terms:
|
Line 12 terms:
|
All of the documentation and software included in the ELWIX and AITNET |
All of the documentation and software included in the ELWIX and AITNET |
Releases is copyrighted by ELWIX - Sofia/Bulgaria <info@elwix.org> |
Releases is copyrighted by ELWIX - Sofia/Bulgaria <info@elwix.org> |
|
|
Copyright 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 | Copyright 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 |
by Michael Pounov <misho@elwix.org>. All rights reserved. |
by Michael Pounov <misho@elwix.org>. All rights reserved. |
|
|
Redistribution and use in source and binary forms, with or without |
Redistribution and use in source and binary forms, with or without |
Line 110 sched_hook_cancel(void *task, void *arg __unused)
|
Line 110 sched_hook_cancel(void *task, void *arg __unused)
|
#ifdef AIO_SUPPORT |
#ifdef AIO_SUPPORT |
struct aiocb *acb; |
struct aiocb *acb; |
#ifdef EVFILT_LIO |
#ifdef EVFILT_LIO |
|
register int i = 0; |
struct aiocb **acbs; |
struct aiocb **acbs; |
register int i; |
|
#endif /* EVFILT_LIO */ |
#endif /* EVFILT_LIO */ |
#endif /* AIO_SUPPORT */ |
#endif /* AIO_SUPPORT */ |
|
|
Line 219 sched_hook_cancel(void *task, void *arg __unused)
|
Line 219 sched_hook_cancel(void *task, void *arg __unused)
|
return NULL; |
return NULL; |
} |
} |
|
|
|
#ifdef HAVE_LIBPTHREAD |
/* |
/* |
|
* sched_hook_thread() - Default THREAD hook |
|
* |
|
* @task = current task |
|
* @arg = pthread attributes |
|
* return: <0 errors and 0 ok |
|
*/ |
|
void * |
|
sched_hook_thread(void *task, void *arg) |
|
{ |
|
sched_task_t *t = task; |
|
pthread_t tid; |
|
sigset_t s, o; |
|
|
|
if (!t || !TASK_ROOT(t)) |
|
return (void*) -1; |
|
|
|
sigfillset(&s); |
|
pthread_sigmask(SIG_BLOCK, &s, &o); |
|
if ((errno = pthread_create(&tid, (pthread_attr_t*) arg, |
|
(void *(*)(void*)) _sched_threadWrapper, t))) { |
|
LOGERR; |
|
pthread_sigmask(SIG_SETMASK, &o, NULL); |
|
return (void*) -1; |
|
} else |
|
TASK_VAL(t) = (u_long) tid; |
|
|
|
if (!TASK_ISLOCKED(t)) |
|
TASK_LOCK(t); |
|
|
|
pthread_sigmask(SIG_SETMASK, &o, NULL); |
|
return NULL; |
|
} |
|
#endif |
|
|
|
/* |
* sched_hook_read() - Default READ hook |
* sched_hook_read() - Default READ hook |
* |
* |
* @task = current task |
* @task = current task |
Line 596 sched_hook_fetch(void *root, void *arg __unused)
|
Line 632 sched_hook_fetch(void *root, void *arg __unused)
|
TAILQ_FOREACH_SAFE(task, &r->root_read, task_node, tmp) { |
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; |
else | else { |
flg++; |
flg++; |
|
TASK_RET(task) = res[i].data; |
|
TASK_FLAG(task) = res[i].fflags; |
|
} |
/* remove read handle */ |
/* remove read handle */ |
#ifdef HAVE_LIBPTHREAD |
#ifdef HAVE_LIBPTHREAD |
pthread_mutex_lock(&r->root_mtx[taskREAD]); |
pthread_mutex_lock(&r->root_mtx[taskREAD]); |
Line 646 sched_hook_fetch(void *root, void *arg __unused)
|
Line 685 sched_hook_fetch(void *root, void *arg __unused)
|
TAILQ_FOREACH_SAFE(task, &r->root_write, task_node, tmp) { |
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; |
else | else { |
flg++; |
flg++; |
|
TASK_RET(task) = res[i].data; |
|
TASK_FLAG(task) = res[i].fflags; |
|
} |
/* remove write handle */ |
/* remove write handle */ |
#ifdef HAVE_LIBPTHREAD |
#ifdef HAVE_LIBPTHREAD |
pthread_mutex_lock(&r->root_mtx[taskWRITE]); |
pthread_mutex_lock(&r->root_mtx[taskWRITE]); |
Line 696 sched_hook_fetch(void *root, void *arg __unused)
|
Line 738 sched_hook_fetch(void *root, void *arg __unused)
|
TAILQ_FOREACH_SAFE(task, &r->root_alarm, task_node, tmp) { |
TAILQ_FOREACH_SAFE(task, &r->root_alarm, task_node, tmp) { |
if ((uintptr_t) TASK_DATA(task) != ((uintptr_t) res[i].udata)) |
if ((uintptr_t) TASK_DATA(task) != ((uintptr_t) res[i].udata)) |
continue; |
continue; |
else | else { |
flg++; |
flg++; |
|
TASK_RET(task) = res[i].data; |
|
TASK_FLAG(task) = res[i].fflags; |
|
} |
/* remove alarm handle */ |
/* remove alarm handle */ |
#ifdef HAVE_LIBPTHREAD |
#ifdef HAVE_LIBPTHREAD |
pthread_mutex_lock(&r->root_mtx[taskALARM]); |
pthread_mutex_lock(&r->root_mtx[taskALARM]); |
Line 726 sched_hook_fetch(void *root, void *arg __unused)
|
Line 771 sched_hook_fetch(void *root, void *arg __unused)
|
continue; |
continue; |
else { |
else { |
flg++; |
flg++; |
TASK_DATA(task) = (void*) (uintptr_t) res[i].data; | TASK_RET(task) = res[i].data; |
TASK_DATLEN(task) = res[i].fflags; | TASK_FLAG(task) = res[i].fflags; |
} |
} |
/* remove node handle */ |
/* remove node handle */ |
#ifdef HAVE_LIBPTHREAD |
#ifdef HAVE_LIBPTHREAD |
Line 757 sched_hook_fetch(void *root, void *arg __unused)
|
Line 802 sched_hook_fetch(void *root, void *arg __unused)
|
continue; |
continue; |
else { |
else { |
flg++; |
flg++; |
TASK_DATA(task) = (void*) (uintptr_t) res[i].data; | TASK_RET(task) = res[i].data; |
TASK_DATLEN(task) = res[i].fflags; | TASK_FLAG(task) = res[i].fflags; |
} |
} |
/* remove proc handle */ |
/* remove proc handle */ |
#ifdef HAVE_LIBPTHREAD |
#ifdef HAVE_LIBPTHREAD |
Line 786 sched_hook_fetch(void *root, void *arg __unused)
|
Line 831 sched_hook_fetch(void *root, void *arg __unused)
|
TAILQ_FOREACH_SAFE(task, &r->root_signal, task_node, tmp) { |
TAILQ_FOREACH_SAFE(task, &r->root_signal, task_node, tmp) { |
if (TASK_VAL(task) != ((uintptr_t) res[i].udata)) |
if (TASK_VAL(task) != ((uintptr_t) res[i].udata)) |
continue; |
continue; |
else | else { |
flg++; |
flg++; |
|
TASK_RET(task) = res[i].data; |
|
TASK_FLAG(task) = res[i].fflags; |
|
} |
/* remove signal handle */ |
/* remove signal handle */ |
#ifdef HAVE_LIBPTHREAD |
#ifdef HAVE_LIBPTHREAD |
pthread_mutex_lock(&r->root_mtx[taskSIGNAL]); |
pthread_mutex_lock(&r->root_mtx[taskSIGNAL]); |
Line 816 sched_hook_fetch(void *root, void *arg __unused)
|
Line 864 sched_hook_fetch(void *root, void *arg __unused)
|
acb = (struct aiocb*) TASK_VAL(task); |
acb = (struct aiocb*) TASK_VAL(task); |
if (acb != ((struct aiocb*) res[i].udata)) |
if (acb != ((struct aiocb*) res[i].udata)) |
continue; |
continue; |
else | else { |
flg++; |
flg++; |
|
TASK_RET(task) = res[i].data; |
|
TASK_FLAG(task) = res[i].fflags; |
|
} |
/* remove user handle */ |
/* remove user handle */ |
#ifdef HAVE_LIBPTHREAD |
#ifdef HAVE_LIBPTHREAD |
pthread_mutex_lock(&r->root_mtx[taskAIO]); |
pthread_mutex_lock(&r->root_mtx[taskAIO]); |
Line 855 sched_hook_fetch(void *root, void *arg __unused)
|
Line 906 sched_hook_fetch(void *root, void *arg __unused)
|
acbs = (struct aiocb**) TASK_VAL(task); |
acbs = (struct aiocb**) TASK_VAL(task); |
if (acbs != ((struct aiocb**) res[i].udata)) |
if (acbs != ((struct aiocb**) res[i].udata)) |
continue; |
continue; |
else | else { |
flg++; |
flg++; |
|
TASK_RET(task) = res[i].data; |
|
TASK_FLAG(task) = res[i].fflags; |
|
} |
/* remove user handle */ |
/* remove user handle */ |
#ifdef HAVE_LIBPTHREAD |
#ifdef HAVE_LIBPTHREAD |
pthread_mutex_lock(&r->root_mtx[taskLIO]); |
pthread_mutex_lock(&r->root_mtx[taskLIO]); |
Line 904 sched_hook_fetch(void *root, void *arg __unused)
|
Line 958 sched_hook_fetch(void *root, void *arg __unused)
|
continue; |
continue; |
else { |
else { |
flg++; |
flg++; |
TASK_DATA(task) = (void*) res[i].data; | TASK_RET(task) = res[i].data; |
TASK_DATLEN(task) = res[i].fflags; | TASK_FLAG(task) = res[i].fflags; |
} |
} |
/* remove user handle */ |
/* remove user handle */ |
#ifdef HAVE_LIBPTHREAD |
#ifdef HAVE_LIBPTHREAD |