Skip to content

Commit

Permalink
Update xPortRunning before resuming first task (FreeRTOS#1049)
Browse files Browse the repository at this point in the history
The variable `xPortRunning` is now updated before starting the first
task.

It fixes the following issue -
https://forums.freertos.org/t/possible-bug-in-the-way-prvtimertask-thread-function-is-started-in-win32-port/19959/

Signed-off-by: Gaurav Aggarwal <[email protected]>
  • Loading branch information
aggarg authored May 7, 2024
1 parent 2eb2d65 commit 78c8bbd
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions portable/MSVC-MingW/port.c
Original file line number Diff line number Diff line change
Expand Up @@ -353,12 +353,12 @@ BaseType_t xPortStartScheduler( void )
pxThreadState = ( ThreadState_t * ) *( ( size_t * ) pxCurrentTCB );
ulCriticalNesting = portNO_CRITICAL_NESTING;

/* Start the first task. */
ResumeThread( pxThreadState->pvThread );

/* The scheduler is now running. */
xPortRunning = pdTRUE;

/* Start the first task. */
ResumeThread( pxThreadState->pvThread );

/* Handle all simulated interrupts - including yield requests and
* simulated ticks. */
prvProcessSimulatedInterrupts();
Expand Down

0 comments on commit 78c8bbd

Please sign in to comment.