--- libaitsched/src/aitsched.c 2012/08/23 00:31:41 1.15.2.3 +++ libaitsched/src/aitsched.c 2013/05/26 20:14:02 1.17.2.1 @@ -3,7 +3,7 @@ * by Michael Pounov * * $Author: misho $ -* $Id: aitsched.c,v 1.15.2.3 2012/08/23 00:31:41 misho Exp $ +* $Id: aitsched.c,v 1.17.2.1 2013/05/26 20:14:02 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 @@ -56,21 +56,21 @@ char sched_Error[STRSIZ]; // sched_GetErrno() Get error code of last operation -inline int +int sched_GetErrno() { return sched_Errno; } // sched_GetError() Get error text of last operation -inline const char * +const char * sched_GetError() { return sched_Error; } // sched_SetErr() Set error to variables for internal use!!! -inline void +void sched_SetErr(int eno, char *estr, ...) { va_list lst; @@ -121,16 +121,6 @@ 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 * @@ -161,7 +151,7 @@ schedInit(void ** __restrict data, size_t datlen) #ifdef HAVE_LIBPTHREAD for (i = 0; i < taskMAX; i++) - if (pthread_mutex_init(&root->root_mtx[i], NULL)) { + if ((errno = pthread_mutex_init(&root->root_mtx[i], NULL))) { LOGERR; while (i) pthread_mutex_destroy(&root->root_mtx[--i]); @@ -191,8 +181,6 @@ 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 @@ -293,7 +281,7 @@ schedEnd(sched_root_task_t ** __restrict root) * @task = current task * return: !=NULL error or =NULL ok */ -inline void * +void * schedCall(sched_task_t * __restrict task) { void *ptr = (void*) -1; @@ -316,7 +304,7 @@ schedCall(sched_task_t * __restrict task) * @root = root task * return: =NULL error or !=NULL ready task */ -inline void * +void * schedFetch(sched_root_task_t * __restrict root) { void *ptr; @@ -671,7 +659,7 @@ schedRun(sched_root_task_t *root, volatile intptr_t * * @tsold = old timeout polling if !=NULL * return: -1 error or 0 ok */ -inline int +int schedPolling(sched_root_task_t * __restrict root, struct timespec * __restrict ts, struct timespec * __restrict tsold) { @@ -696,7 +684,7 @@ schedPolling(sched_root_task_t * __restrict root, stru * @condValue = condition value, kill schedRun() if condValue == killState * return: -1 error or 0 ok */ -inline int +int schedTermCondition(sched_root_task_t * __restrict root, intptr_t condValue) { if (!root)