mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-04-20 05:21:59 -04:00
Added vPortCheckCorrectThreadIsRunning() function to the Win32 port layer to trap when Windows is not running the correct thread and try and catch it.
This commit is contained in:
parent
1ae93fbb63
commit
2fc309624b
|
@ -532,4 +532,19 @@ long lMutexNeedsReleasing;
|
|||
ReleaseMutex( pvInterruptEventMutex );
|
||||
}
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
void vPortCheckCorrectThreadIsRunning( void )
|
||||
{
|
||||
xThreadState *pxThreadState = ( xThreadState * ) *( ( unsigned long * ) pxCurrentTCB );
|
||||
|
||||
/* When switching threads, Windows does not always seem to run the selected
|
||||
thread immediately. This function can be called to check if the thread
|
||||
that is currently running is the thread that is responsible for executing
|
||||
the task selected by the real time scheduler. */
|
||||
if( GetCurrentThread() != pxThreadState->pvThread )
|
||||
{
|
||||
SwitchToThread();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue