mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-12-07 05:34:59 -05:00
The PTHREAD_ONCE_INIT and struct is a typedef for 0 on linux. On MacOS it needs a specific value, so need to wrap the setting of it for the difference in the two OSs
This commit is contained in:
parent
400baa16b6
commit
21f429f0b4
1 changed files with 8 additions and 3 deletions
11
portable/ThirdParty/GCC/Posix/port.c
vendored
11
portable/ThirdParty/GCC/Posix/port.c
vendored
|
|
@ -53,6 +53,7 @@
|
|||
|
||||
#include <errno.h>
|
||||
#include <pthread.h>
|
||||
#include <limits.h>
|
||||
#include <signal.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
|
@ -268,9 +269,13 @@ BaseType_t xPortStartScheduler( void )
|
|||
|
||||
/* Reset pthread_once_t, needed to restart the scheduler again.
|
||||
* memset the internal struct members for MacOS/Linux Compatability */
|
||||
memset( ( void * ) &hSigSetupThread.__sig, _PTHREAD_ONCE_SIG_init, sizeof(_PTHREAD_ONCE_SIG_init));
|
||||
memset( ( void * ) &hSigSetupThread.__opaque, 0, sizeof(hSigSetupThread.__opaque));
|
||||
|
||||
#if __APPLE__
|
||||
memset( ( void * ) &hSigSetupThread.__sig, _PTHREAD_ONCE_SIG_init, sizeof(_PTHREAD_ONCE_SIG_init));
|
||||
memset( ( void * ) &hSigSetupThread.__opaque, 0, sizeof(hSigSetupThread.__opaque));
|
||||
#else /* Linux PTHREAD library*/
|
||||
hSigSetupThread = PTHREAD_ONCE_INIT;
|
||||
#endif /* __APPLE__*/
|
||||
|
||||
/* Restore original signal mask. */
|
||||
( void ) pthread_sigmask( SIG_SETMASK, &xSchedulerOriginalSignalMask, NULL );
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue