mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-04-19 21:11:57 -04:00
Merge branch 'main' into clear-pending-signals
This commit is contained in:
commit
b71be3e293
17
portable/ThirdParty/GCC/Posix/port.c
vendored
17
portable/ThirdParty/GCC/Posix/port.c
vendored
|
@ -97,6 +97,7 @@ static inline Thread_t * prvGetThreadFromTask( TaskHandle_t xTask )
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
static pthread_once_t hSigSetupThread = PTHREAD_ONCE_INIT;
|
static pthread_once_t hSigSetupThread = PTHREAD_ONCE_INIT;
|
||||||
|
static pthread_once_t hThreadKeyOnce = PTHREAD_ONCE_INIT;
|
||||||
static sigset_t xAllSignals;
|
static sigset_t xAllSignals;
|
||||||
static sigset_t xSchedulerOriginalSignalMask;
|
static sigset_t xSchedulerOriginalSignalMask;
|
||||||
static pthread_t hMainThread = ( pthread_t ) NULL;
|
static pthread_t hMainThread = ( pthread_t ) NULL;
|
||||||
|
@ -105,7 +106,6 @@ static BaseType_t xSchedulerEnd = pdFALSE;
|
||||||
static pthread_t hTimerTickThread;
|
static pthread_t hTimerTickThread;
|
||||||
static bool xTimerTickThreadShouldRun;
|
static bool xTimerTickThreadShouldRun;
|
||||||
static uint64_t prvStartTimeNs;
|
static uint64_t prvStartTimeNs;
|
||||||
static pthread_mutex_t xThreadMutex = PTHREAD_MUTEX_INITIALIZER;
|
|
||||||
static pthread_key_t xThreadKey = 0;
|
static pthread_key_t xThreadKey = 0;
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
@ -133,23 +133,16 @@ static void prvThreadKeyDestructor( void * pvData )
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
static void prvInitThreadKey( void )
|
static void prvInitThreadKey( void )
|
||||||
{
|
|
||||||
pthread_mutex_lock( &xThreadMutex );
|
|
||||||
|
|
||||||
if( xThreadKey == 0 )
|
|
||||||
{
|
{
|
||||||
pthread_key_create( &xThreadKey, prvThreadKeyDestructor );
|
pthread_key_create( &xThreadKey, prvThreadKeyDestructor );
|
||||||
}
|
}
|
||||||
|
|
||||||
pthread_mutex_unlock( &xThreadMutex );
|
|
||||||
}
|
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
static void prvMarkAsFreeRTOSThread( void )
|
static void prvMarkAsFreeRTOSThread( void )
|
||||||
{
|
{
|
||||||
uint8_t * pucThreadData = NULL;
|
uint8_t * pucThreadData = NULL;
|
||||||
|
|
||||||
prvInitThreadKey();
|
( void ) pthread_once( &hThreadKeyOnce, prvInitThreadKey );
|
||||||
|
|
||||||
pucThreadData = malloc( 1 );
|
pucThreadData = malloc( 1 );
|
||||||
configASSERT( pucThreadData != NULL );
|
configASSERT( pucThreadData != NULL );
|
||||||
|
@ -165,7 +158,10 @@ static BaseType_t prvIsFreeRTOSThread( void )
|
||||||
uint8_t * pucThreadData = NULL;
|
uint8_t * pucThreadData = NULL;
|
||||||
BaseType_t xRet = pdFALSE;
|
BaseType_t xRet = pdFALSE;
|
||||||
|
|
||||||
|
( void ) pthread_once( &hThreadKeyOnce, prvInitThreadKey );
|
||||||
|
|
||||||
pucThreadData = ( uint8_t * ) pthread_getspecific( xThreadKey );
|
pucThreadData = ( uint8_t * ) pthread_getspecific( xThreadKey );
|
||||||
|
|
||||||
if( ( pucThreadData != NULL ) && ( *pucThreadData == 1 ) )
|
if( ( pucThreadData != NULL ) && ( *pucThreadData == 1 ) )
|
||||||
{
|
{
|
||||||
xRet = pdTRUE;
|
xRet = pdTRUE;
|
||||||
|
@ -313,9 +309,12 @@ BaseType_t xPortStartScheduler( void )
|
||||||
* memset the internal struct members for MacOS/Linux Compatibility */
|
* memset the internal struct members for MacOS/Linux Compatibility */
|
||||||
#if __APPLE__
|
#if __APPLE__
|
||||||
hSigSetupThread.__sig = _PTHREAD_ONCE_SIG_init;
|
hSigSetupThread.__sig = _PTHREAD_ONCE_SIG_init;
|
||||||
|
hThreadKeyOnce.__sig = _PTHREAD_ONCE_SIG_init;
|
||||||
memset( ( void * ) &hSigSetupThread.__opaque, 0, sizeof( hSigSetupThread.__opaque ) );
|
memset( ( void * ) &hSigSetupThread.__opaque, 0, sizeof( hSigSetupThread.__opaque ) );
|
||||||
|
memset( ( void * ) &hThreadKeyOnce.__opaque, 0, sizeof( hThreadKeyOnce.__opaque ) );
|
||||||
#else /* Linux PTHREAD library*/
|
#else /* Linux PTHREAD library*/
|
||||||
hSigSetupThread = PTHREAD_ONCE_INIT;
|
hSigSetupThread = PTHREAD_ONCE_INIT;
|
||||||
|
hThreadKeyOnce = PTHREAD_ONCE_INIT;
|
||||||
#endif /* __APPLE__*/
|
#endif /* __APPLE__*/
|
||||||
|
|
||||||
/* Restore original signal mask. */
|
/* Restore original signal mask. */
|
||||||
|
|
Loading…
Reference in a new issue