Skip to content

Commit 78c8bbd

Browse files
authored
Update xPortRunning before resuming first task (FreeRTOS#1049)
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]>
1 parent 2eb2d65 commit 78c8bbd

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

portable/MSVC-MingW/port.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -353,12 +353,12 @@ BaseType_t xPortStartScheduler( void )
353353
pxThreadState = ( ThreadState_t * ) *( ( size_t * ) pxCurrentTCB );
354354
ulCriticalNesting = portNO_CRITICAL_NESTING;
355355

356-
/* Start the first task. */
357-
ResumeThread( pxThreadState->pvThread );
358-
359356
/* The scheduler is now running. */
360357
xPortRunning = pdTRUE;
361358

359+
/* Start the first task. */
360+
ResumeThread( pxThreadState->pvThread );
361+
362362
/* Handle all simulated interrupts - including yield requests and
363363
* simulated ticks. */
364364
prvProcessSimulatedInterrupts();

0 commit comments

Comments
 (0)