Change the pthread_once_t reset in vPortEndScheduler() to work for MacOS

This commit is contained in:
Soren Ptak 2024-01-18 08:07:47 -05:00
parent c083af972a
commit 400baa16b6

View file

@ -266,9 +266,10 @@ BaseType_t xPortStartScheduler( void )
*/
xSchedulerEnd = pdFALSE;
/* Reset the pthread_once_t structure. This is required if the port
* starts the scheduler again. */
hSigSetupThread = PTHREAD_ONCE_INIT;
/* 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));
/* Restore original signal mask. */
( void ) pthread_sigmask( SIG_SETMASK, &xSchedulerOriginalSignalMask, NULL );