--- libaitsched/src/aitsched.c 2012/08/22 23:43:36 1.15.2.2 +++ libaitsched/src/aitsched.c 2012/08/23 00:31:41 1.15.2.3 @@ -3,7 +3,7 @@ * by Michael Pounov * * $Author: misho $ -* $Id: aitsched.c,v 1.15.2.2 2012/08/22 23:43:36 misho Exp $ +* $Id: aitsched.c,v 1.15.2.3 2012/08/23 00:31:41 misho Exp $ * ************************************************************************** The ELWIX and AITNET software is distributed under the following @@ -121,6 +121,16 @@ schedRegisterHooks(sched_root_task_t * __restrict root return 0; } +#ifdef HAVE_LIBPTHREAD +static void +_sched_threadChild() +{ + pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); + pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL); + pthread_testcancel(); +} +#endif + /* * schedInit() - Init scheduler * @@ -181,6 +191,8 @@ schedInit(void ** __restrict data, size_t datlen) TAILQ_INIT(&root->root_thread); #ifdef HAVE_LIBPTHREAD + pthread_atfork(NULL, NULL, _sched_threadChild); + for (i = 0; i < taskMAX; i++) pthread_mutex_unlock(&root->root_mtx[i]); #endif