--- libaitsched/src/tasks.c 2014/01/28 10:21:43 1.22.8.1 +++ libaitsched/src/tasks.c 2014/05/21 21:55:11 1.24.2.2 @@ -3,7 +3,7 @@ * by Michael Pounov * * $Author: misho $ -* $Id: tasks.c,v 1.22.8.1 2014/01/28 10:21:43 misho Exp $ +* $Id: tasks.c,v 1.24.2.2 2014/05/21 21:55:11 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, 2013 +Copyright 2004 - 2014 by Michael Pounov . All rights reserved. Redistribution and use in source and binary forms, with or without @@ -146,7 +146,7 @@ _sched_threadWrapper(sched_task_t *t) } #endif -#if defined(HAVE_TIMER_CREATE) && defined(HAVE_TIMER_SETTIME) +#if defined(HAVE_TIMER_CREATE) && defined(HAVE_TIMER_SETTIME) && defined(HAVE_TIMER_DELETE) void * _sched_rtcWrapper(sched_task_t *t) { @@ -505,6 +505,10 @@ sched_task_t * schedSignal(sched_root_task_t * __restrict root, sched_task_func_t func, void *arg, u_long sig, void *opt_data, size_t opt_dlen) { +#ifdef KQ_DISABLE + sched_SetErr(ENOTSUP, "disabled kqueue support"); + return NULL; +#else sched_task_t *task; void *ptr; @@ -542,6 +546,7 @@ schedSignal(sched_root_task_t * __restrict root, sched task = sched_unuseTask(task); return task; +#endif /* KQ_DISABLE */ } /* @@ -1325,7 +1330,7 @@ schedThread(sched_root_task_t * __restrict root, sched TASK_DATLEN(task) = opt_dlen; pthread_attr_init(&attr); - pthread_attr_setdetachstate(&attr, PTHREAD_DETACHED); + pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); if (ss && (errno = pthread_attr_setstacksize(&attr, ss))) { LOGERR; pthread_attr_destroy(&attr); @@ -1337,11 +1342,7 @@ schedThread(sched_root_task_t * __restrict root, sched return sched_unuseTask(task); } else TASK_FLAG(task) = ss; - if ((errno = pthread_attr_setguardsize(&attr, ss))) { - LOGERR; - pthread_attr_destroy(&attr); - return sched_unuseTask(task); - } + #ifdef SCHED_RR pthread_attr_setschedpolicy(&attr, SCHED_RR); #else @@ -1376,7 +1377,7 @@ sched_task_t * schedRTC(sched_root_task_t * __restrict root, sched_task_func_t func, void *arg, struct timespec ts, void *opt_data, size_t opt_dlen) { -#if defined(HAVE_TIMER_CREATE) && defined(HAVE_TIMER_SETTIME) +#if defined(HAVE_TIMER_CREATE) && defined(HAVE_TIMER_SETTIME) && defined(HAVE_TIMER_DELETE) sched_task_t *task; void *ptr;