diff --git a/portable/ThirdParty/GCC/Posix/port.c b/portable/ThirdParty/GCC/Posix/port.c index 5dc7f45f8f..ac45b7d69a 100644 --- a/portable/ThirdParty/GCC/Posix/port.c +++ b/portable/ThirdParty/GCC/Posix/port.c @@ -261,7 +261,7 @@ void vPortStartFirstTask( void ) */ BaseType_t xPortStartScheduler( void ) { - int iSignal; + int iSignal = 0; sigset_t xSignals; hMainThread = pthread_self(); @@ -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__ */ } /*