--- libaitsched/src/hooks.c 2012/08/23 00:31:41 1.14.2.5 +++ libaitsched/src/hooks.c 2012/08/23 02:09:54 1.14.2.6 @@ -3,7 +3,7 @@ * by Michael Pounov * * $Author: misho $ -* $Id: hooks.c,v 1.14.2.5 2012/08/23 00:31:41 misho Exp $ +* $Id: hooks.c,v 1.14.2.6 2012/08/23 02:09:54 misho Exp $ * ************************************************************************** The ELWIX and AITNET software is distributed under the following @@ -107,10 +107,10 @@ sched_hook_cancel(void *task, void *arg __unused) sched_task_t *t = task; struct kevent chg[1]; struct timespec timeout = { 0, 0 }; - register int i = 0; #ifdef AIO_SUPPORT struct aiocb *acb; #ifdef EVFILT_LIO + register int i = 0; struct aiocb **acbs; #endif /* EVFILT_LIO */ #endif /* AIO_SUPPORT */ @@ -209,16 +209,7 @@ sched_hook_cancel(void *task, void *arg __unused) #endif case taskTHREAD: #ifdef HAVE_LIBPTHREAD - for (i = 0; i < MAX_TASK_MISS; i++) - if (!pthread_cancel((pthread_t) TASK_VAL(t))) { - /* joinable thread */ - if (TASK_FLAG(t) == PTHREAD_CREATE_JOINABLE) - schedTask(TASK_ROOT(t), _sched_threadJoin, - TASK_ARG(t), TASK_VAL(t), - TASK_DATA(t), TASK_DATLEN(t)); - return NULL; - } - return (void*) -1; + pthread_cancel((pthread_t) TASK_VAL(t)); #endif default: return NULL; @@ -249,16 +240,16 @@ sched_hook_thread(void *task, void *arg) sigfillset(&s); pthread_sigmask(SIG_BLOCK, &s, &o); if (pthread_create(&tid, (pthread_attr_t*) arg, - (void *(*)(void*)) TASK_FUNC(t), t)) { + (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); - TASK_VAL(t) = (u_long) tid; pthread_sigmask(SIG_SETMASK, &o, NULL); return NULL; }