--- libaitsched/src/hooks.c 2012/08/01 14:11:43 1.10.2.2 +++ libaitsched/src/hooks.c 2012/08/01 14:27:52 1.10.2.3 @@ -3,7 +3,7 @@ * by Michael Pounov * * $Author: misho $ -* $Id: hooks.c,v 1.10.2.2 2012/08/01 14:11:43 misho Exp $ +* $Id: hooks.c,v 1.10.2.3 2012/08/01 14:27:52 misho Exp $ * ************************************************************************** The ELWIX and AITNET software is distributed under the following @@ -107,6 +107,9 @@ sched_hook_cancel(void *task, void *arg __unused) sched_task_t *t = task; struct kevent chg[1]; struct timespec timeout = { 0, 0 }; +#ifdef EVFILT_AIO + struct aiocb *acb; +#endif if (!t || !TASK_ROOT(t)) return (void*) -1; @@ -163,8 +166,10 @@ sched_hook_cancel(void *task, void *arg __unused) #else EV_SET(&chg[0], TASK_VAL(t), EVFILT_AIO, EV_DELETE, 0, 0, (void*) TASK_VAL(t)); #endif - if (TASK_VAL(t)) { - free((void*) TASK_VAL(t)); + acb = (struct aiocb*) TASK_VAL(t); + if (acb) { + aio_cancel(acb->aio_fildes, acb); + free(acb); TASK_VAL(t) = 0; } break;