Skip to content
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

Do not call exit() on MSVC Port when calling vPortEndScheduler #624

Merged
merged 5 commits into from
Feb 15, 2023
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 22 additions & 23 deletions portable/MSVC-MingW/port.c
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ TIMECAPS xTimeCaps;
/* Just to prevent compiler warnings. */
( void ) lpParameter;

for( ;; )
while(pdTRUE == xPortRunning)
Ju1He1 marked this conversation as resolved.
Show resolved Hide resolved
{
/* Wait until the timer expires and we can access the simulated interrupt
variables. *NOTE* this is not a 'real time' way of generating tick
Expand All @@ -176,33 +176,32 @@ TIMECAPS xTimeCaps;
{
Sleep( portTICK_PERIOD_MS );
}
if(pdTRUE == xPortRunning)
Ju1He1 marked this conversation as resolved.
Show resolved Hide resolved
{
configASSERT( xPortRunning );

configASSERT( xPortRunning );

/* Can't proceed if in a critical section as pvInterruptEventMutex won't
be available. */
WaitForSingleObject( pvInterruptEventMutex, INFINITE );
/* Can't proceed if in a critical section as pvInterruptEventMutex won't
be available. */
WaitForSingleObject( pvInterruptEventMutex, INFINITE );

/* The timer has expired, generate the simulated tick event. */
ulPendingInterrupts |= ( 1 << portINTERRUPT_TICK );
/* The timer has expired, generate the simulated tick event. */
ulPendingInterrupts |= ( 1 << portINTERRUPT_TICK );

/* The interrupt is now pending - notify the simulated interrupt
handler thread. Must be outside of a critical section to get here so
the handler thread can execute immediately pvInterruptEventMutex is
released. */
configASSERT( ulCriticalNesting == 0UL );
SetEvent( pvInterruptEvent );
/* The interrupt is now pending - notify the simulated interrupt
handler thread. Must be outside of a critical section to get here so
the handler thread can execute immediately pvInterruptEventMutex is
released. */
configASSERT( ulCriticalNesting == 0UL );
SetEvent( pvInterruptEvent );

/* Give back the mutex so the simulated interrupt handler unblocks
and can access the interrupt handler variables. */
ReleaseMutex( pvInterruptEventMutex );
/* Give back the mutex so the simulated interrupt handler unblocks
and can access the interrupt handler variables. */
ReleaseMutex( pvInterruptEventMutex );
}
}

#ifdef __GNUC__
/* Should never reach here - MingW complains if you leave this line out,
MSVC complains if you put it in. */
return 0;
#endif

return 0;
}
/*-----------------------------------------------------------*/

Expand Down Expand Up @@ -566,7 +565,7 @@ uint32_t ulErrorCode;

void vPortEndScheduler( void )
{
exit( 0 );
xPortRunning = pdFALSE;
}
/*-----------------------------------------------------------*/

Expand Down