Enable MSVC Port to leave the prvProcessSimulatedInterrupts loop when scheduler is stopped (#728)

* allow to leave loop

* add missing brace

* Code review suggestions

Signed-off-by: Gaurav Aggarwal <aggarg@amazon.com>

---------

Signed-off-by: Gaurav Aggarwal <aggarg@amazon.com>
Co-authored-by: Gaurav-Aggarwal-AWS <33462878+aggarg@users.noreply.github.com>
Co-authored-by: Gaurav Aggarwal <aggarg@amazon.com>
pull/733/head^2
Ju1He1 2 years ago committed by GitHub
parent 8d80cf697a
commit 225bace85c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -340,6 +340,9 @@ SYSTEM_INFO xSystemInfo;
/* Start the first task. */
ResumeThread( pxThreadState->pvThread );
/* The scheduler is now running. */
xPortRunning = pdTRUE;
/* Handle all simulated interrupts - including yield requests and
simulated ticks. */
prvProcessSimulatedInterrupts();
@ -376,6 +379,8 @@ uint32_t ulSwitchRequired, i;
ThreadState_t *pxThreadState;
void *pvObjectList[ 2 ];
CONTEXT xContext;
DWORD xWinApiResult;
const DWORD xTimeoutMilliseconds = 1000;
/* Going to block on the mutex that ensured exclusive access to the simulated
interrupt objects, and the event that signals that a simulated interrupt
@ -388,13 +393,16 @@ CONTEXT xContext;
ulPendingInterrupts |= ( 1 << portINTERRUPT_TICK );
SetEvent( pvInterruptEvent );
xPortRunning = pdTRUE;
for(;;)
while( xPortRunning == pdTRUE )
{
xInsideInterrupt = pdFALSE;
WaitForMultipleObjects( sizeof( pvObjectList ) / sizeof( void * ), pvObjectList, TRUE, INFINITE );
/* Wait with timeout so that we can exit from this loop when
* the scheduler is stopped by calling vPortEndScheduler. */
xWinApiResult = WaitForMultipleObjects( sizeof( pvObjectList ) / sizeof( void * ), pvObjectList, TRUE, xTimeoutMilliseconds );
if( xWinApiResult != WAIT_TIMEOUT )
{
/* Cannot be in a critical section to get here. Tasks that exit a
critical section will block on a yield mutex to wait for an interrupt to
process if an interrupt was set pending while the task was inside the
@ -488,6 +496,7 @@ CONTEXT xContext;
SetEvent( pxThreadState->pvYieldEvent );
ReleaseMutex( pvInterruptEventMutex );
}
}
}
/*-----------------------------------------------------------*/

Loading…
Cancel
Save