@@ -160,7 +160,7 @@ TIMECAPS xTimeCaps;
160
160
/* Just to prevent compiler warnings. */
161
161
( void ) lpParameter ;
162
162
163
- for ( ;; )
163
+ while ( xPortRunning == pdTRUE )
164
164
{
165
165
/* Wait until the timer expires and we can access the simulated interrupt
166
166
variables. *NOTE* this is not a 'real time' way of generating tick
@@ -177,32 +177,32 @@ TIMECAPS xTimeCaps;
177
177
Sleep ( portTICK_PERIOD_MS );
178
178
}
179
179
180
- configASSERT ( xPortRunning );
180
+ if ( xPortRunning == pdTRUE )
181
+ {
182
+ configASSERT ( xPortRunning );
181
183
182
- /* Can't proceed if in a critical section as pvInterruptEventMutex won't
183
- be available. */
184
- WaitForSingleObject ( pvInterruptEventMutex , INFINITE );
184
+ /* Can't proceed if in a critical section as pvInterruptEventMutex won't
185
+ be available. */
186
+ WaitForSingleObject ( pvInterruptEventMutex , INFINITE );
185
187
186
- /* The timer has expired, generate the simulated tick event. */
187
- ulPendingInterrupts |= ( 1 << portINTERRUPT_TICK );
188
+ /* The timer has expired, generate the simulated tick event. */
189
+ ulPendingInterrupts |= ( 1 << portINTERRUPT_TICK );
188
190
189
- /* The interrupt is now pending - notify the simulated interrupt
190
- handler thread. Must be outside of a critical section to get here so
191
- the handler thread can execute immediately pvInterruptEventMutex is
192
- released. */
193
- configASSERT ( ulCriticalNesting == 0UL );
194
- SetEvent ( pvInterruptEvent );
191
+ /* The interrupt is now pending - notify the simulated interrupt
192
+ handler thread. Must be outside of a critical section to get here so
193
+ the handler thread can execute immediately pvInterruptEventMutex is
194
+ released. */
195
+ configASSERT ( ulCriticalNesting == 0UL );
196
+ SetEvent ( pvInterruptEvent );
195
197
196
- /* Give back the mutex so the simulated interrupt handler unblocks
197
- and can access the interrupt handler variables. */
198
- ReleaseMutex ( pvInterruptEventMutex );
198
+ /* Give back the mutex so the simulated interrupt handler unblocks
199
+ and can access the interrupt handler variables. */
200
+ ReleaseMutex ( pvInterruptEventMutex );
201
+ }
199
202
}
200
203
201
- #ifdef __GNUC__
202
- /* Should never reach here - MingW complains if you leave this line out,
203
- MSVC complains if you put it in. */
204
- return 0 ;
205
- #endif
204
+
205
+ return 0 ;
206
206
}
207
207
/*-----------------------------------------------------------*/
208
208
@@ -566,7 +566,7 @@ uint32_t ulErrorCode;
566
566
567
567
void vPortEndScheduler ( void )
568
568
{
569
- exit ( 0 ) ;
569
+ xPortRunning = pdFALSE ;
570
570
}
571
571
/*-----------------------------------------------------------*/
572
572
0 commit comments