Skip to content

POSIX Simulator: Clear SIGRESUME (SIGUSR1) when exiting xPortStartScheduler #1224

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 8 commits into from
15 changes: 14 additions & 1 deletion portable/ThirdParty/GCC/Posix/port.c
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ void vPortStartFirstTask( void )
*/
BaseType_t xPortStartScheduler( void )
{
int iSignal;
int iSignal = 0;
sigset_t xSignals;

hMainThread = pthread_self();
Expand All @@ -287,6 +287,19 @@ BaseType_t xPortStartScheduler( void )
while( xSchedulerEnd != pdTRUE )
{
sigwait( &xSignals, &iSignal );

#if __APPLE__
/* For some reason, on macOS when running in LLDB, sigwait() doesn't
* always clear the signal the first time. Clear it again if it's still
* pending.
*/
sigset_t set;
sigpending( &set );
if( sigismember( &set, SIG_RESUME ) )
{
sigwait( &xSignals, &iSignal );
}
#endif /* __APPLE__ */
}

/*
Expand Down