--- libaitsched/src/hooks.c 2012/08/01 15:17:38 1.10.2.5 +++ libaitsched/src/hooks.c 2012/08/01 16:47:06 1.10.2.6 @@ -3,7 +3,7 @@ * by Michael Pounov * * $Author: misho $ -* $Id: hooks.c,v 1.10.2.5 2012/08/01 15:17:38 misho Exp $ +* $Id: hooks.c,v 1.10.2.6 2012/08/01 16:47:06 misho Exp $ * ************************************************************************** The ELWIX and AITNET software is distributed under the following @@ -168,7 +168,8 @@ sched_hook_cancel(void *task, void *arg __unused) #endif acb = (struct aiocb*) TASK_VAL(t); if (acb) { - aio_cancel(acb->aio_fildes, acb); + if (aio_cancel(acb->aio_fildes, acb) == AIO_CANCELED) + aio_return(acb); free(acb); TASK_VAL(t) = 0; } @@ -779,8 +780,7 @@ sched_hook_fetch(void *root, void *arg __unused) flg = 0; TAILQ_FOREACH_SAFE(task, &r->root_aio, task_node, tmp) { acb = (struct aiocb*) TASK_VAL(task); - if (acb != ((struct aiocb*) res[i].ident) || - acb->aio_sigevent.sigev_value.sival_ptr != res[i].udata) + if (acb != ((struct aiocb*) res[i].udata)) continue; else flg++; @@ -808,7 +808,7 @@ sched_hook_fetch(void *root, void *arg __unused) LOGERR; free(acb); - TASK_FD(task) = (u_long) fd; + TASK_FD(task) = fd; TASK_DATLEN(task) = (u_long) len; } /* if match at least 2, don't remove resouce of event */