--- libaitsched/src/hooks.c 2012/08/23 02:33:12 1.15 +++ libaitsched/src/hooks.c 2013/06/03 20:52:53 1.18 @@ -3,7 +3,7 @@ * by Michael Pounov * * $Author: misho $ -* $Id: hooks.c,v 1.15 2012/08/23 02:33:12 misho Exp $ +* $Id: hooks.c,v 1.18 2013/06/03 20:52:53 misho Exp $ * ************************************************************************** The ELWIX and AITNET software is distributed under the following @@ -12,7 +12,7 @@ terms: All of the documentation and software included in the ELWIX and AITNET Releases is copyrighted by ELWIX - Sofia/Bulgaria -Copyright 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 +Copyright 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 by Michael Pounov . All rights reserved. Redistribution and use in source and binary forms, with or without @@ -162,6 +162,8 @@ sched_hook_cancel(void *task, void *arg __unused) #else EV_SET(&chg[0], TASK_VAL(t), EVFILT_SIGNAL, EV_DELETE, 0, 0, (void*) TASK_VAL(t)); #endif + /* restore signal */ + signal(TASK_VAL(t), SIG_DFL); break; #ifdef AIO_SUPPORT case taskAIO: @@ -239,8 +241,8 @@ 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*)) _sched_threadWrapper, t)) { + if ((errno = pthread_create(&tid, (pthread_attr_t*) arg, + (void *(*)(void*)) _sched_threadWrapper, t))) { LOGERR; pthread_sigmask(SIG_SETMASK, &o, NULL); return (void*) -1; @@ -446,6 +448,9 @@ sched_hook_signal(void *task, void *arg __unused) if (!t || !TASK_ROOT(t)) return (void*) -1; + + /* ignore signal */ + signal(TASK_VAL(t), SIG_IGN); #ifdef __NetBSD__ EV_SET(&chg[0], TASK_VAL(t), EVFILT_SIGNAL, EV_ADD, 0, 0, (intptr_t) TASK_VAL(t));