From 68be63bc50dbe3b27b3d60ef14147136bc9bed24 Mon Sep 17 00:00:00 2001 From: peabody124 Date: Sun, 11 Jul 2010 21:42:59 +0000 Subject: [PATCH] Conditional signaling now works on linux git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1075 ebee16cc-31ac-478f-84a7-5cbb03baadba --- .../GCC/Posix/peabody124/port-pthread_cond.c | 12 ++++++++++-- .../FreeRTOS/Source/portable/GCC/Posix/port.c | 2 +- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/flight/PiOS.posix/posix/Libraries/FreeRTOS/Source/portable/GCC/Posix/peabody124/port-pthread_cond.c b/flight/PiOS.posix/posix/Libraries/FreeRTOS/Source/portable/GCC/Posix/peabody124/port-pthread_cond.c index a337ce468..8eab3b367 100644 --- a/flight/PiOS.posix/posix/Libraries/FreeRTOS/Source/portable/GCC/Posix/peabody124/port-pthread_cond.c +++ b/flight/PiOS.posix/posix/Libraries/FreeRTOS/Source/portable/GCC/Posix/peabody124/port-pthread_cond.c @@ -76,7 +76,7 @@ #define MAX_NUMBER_OF_TASKS ( _POSIX_THREAD_THREADS_MAX ) /*-----------------------------------------------------------*/ -#ifndef __DARWIN__ +#ifdef __APPLE__ #define COND_SIGNALING #define CHECK_TASK_RESUMES #define RUNNING_THREAD_MUTEX @@ -86,6 +86,13 @@ #define COND_SIGNALING #define CHECK_TASK_RESUMES #endif +#ifdef __linux__ + #define COND_SIGNALING +// #define CHECK_TASK_RESUMES + #define RUNNING_THREAD_MUTEX + #define TICK_SIGNAL +#endif + /* Parameters to pass to the newly created pthread. */ typedef struct XPARAMS @@ -385,7 +392,7 @@ portLONG lIndex; struct sigaction sigtick; sigtick.sa_flags = 0; sigtick.sa_handler = vPortSystemTickHandler; - sigemptyset( &sigtick.sa_mask ); + sigfillset( &sigtick.sa_mask ); assert ( 0 == sigaction( SIG_TICK, &sigtick, NULL ) ); /* Set-up the timer interrupt. */ @@ -529,6 +536,7 @@ tskTCB * oldTask, * newTask; pthread_sigmask( SIG_SETMASK, &xSignals, NULL); return; } + sched_yield(); retVal = pthread_mutex_trylock( &xSwappingThreadMutex ); } diff --git a/flight/PiOS.posix/posix/Libraries/FreeRTOS/Source/portable/GCC/Posix/port.c b/flight/PiOS.posix/posix/Libraries/FreeRTOS/Source/portable/GCC/Posix/port.c index 5b5f6b38b..8eab3b367 100644 --- a/flight/PiOS.posix/posix/Libraries/FreeRTOS/Source/portable/GCC/Posix/port.c +++ b/flight/PiOS.posix/posix/Libraries/FreeRTOS/Source/portable/GCC/Posix/port.c @@ -87,7 +87,7 @@ #define CHECK_TASK_RESUMES #endif #ifdef __linux__ -// #define COND_SIGNALING + #define COND_SIGNALING // #define CHECK_TASK_RESUMES #define RUNNING_THREAD_MUTEX #define TICK_SIGNAL