mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-04-23 23:11:58 -04:00
Clear SIGRESUME (SIGUSR1) when exiting xPortStartScheduler
This commit is contained in:
parent
78e0cc778a
commit
2fcb0ad63f
30
portable/ThirdParty/GCC/Posix/port.c
vendored
30
portable/ThirdParty/GCC/Posix/port.c
vendored
|
@ -202,6 +202,33 @@ void vPortStartFirstTask( void )
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Clear a signal that is pending for the calling thread.
|
||||||
|
*/
|
||||||
|
void prvClearPendingSignal( int sig )
|
||||||
|
{
|
||||||
|
sigset_t set, oldset;
|
||||||
|
|
||||||
|
/* Block the signal */
|
||||||
|
sigemptyset( &set );
|
||||||
|
sigaddset( &set, sig );
|
||||||
|
pthread_sigmask( SIG_BLOCK, &set, &oldset );
|
||||||
|
|
||||||
|
/* Check if signal is pending */
|
||||||
|
sigpending( &set );
|
||||||
|
|
||||||
|
if( sigismember( &set, sig ) )
|
||||||
|
{
|
||||||
|
int signum;
|
||||||
|
/* Wait for and remove signal */
|
||||||
|
sigwait( &set, &signum );
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Restore the original signal mask */
|
||||||
|
pthread_sigmask( SIG_SETMASK, &oldset, NULL );
|
||||||
|
}
|
||||||
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* See header file for description.
|
* See header file for description.
|
||||||
*/
|
*/
|
||||||
|
@ -250,6 +277,9 @@ BaseType_t xPortStartScheduler( void )
|
||||||
hSigSetupThread = PTHREAD_ONCE_INIT;
|
hSigSetupThread = PTHREAD_ONCE_INIT;
|
||||||
#endif /* __APPLE__*/
|
#endif /* __APPLE__*/
|
||||||
|
|
||||||
|
// Clear SIG_RESUME (SIGUSR1), because it might have fired again while we were shutting things down.
|
||||||
|
prvClearPendingSignal( SIG_RESUME );
|
||||||
|
|
||||||
/* Restore original signal mask. */
|
/* Restore original signal mask. */
|
||||||
( void ) pthread_sigmask( SIG_SETMASK, &xSchedulerOriginalSignalMask, NULL );
|
( void ) pthread_sigmask( SIG_SETMASK, &xSchedulerOriginalSignalMask, NULL );
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue