]> git.sur5r.net Git - freertos/commitdiff
Added vPortCheckCorrectThreadIsRunning() function to the Win32 port layer to trap...
authorRichardBarry <RichardBarry@1d2547de-c912-0410-9cb9-b8ca96c0e9e2>
Sun, 21 Nov 2010 11:34:12 +0000 (11:34 +0000)
committerRichardBarry <RichardBarry@1d2547de-c912-0410-9cb9-b8ca96c0e9e2>
Sun, 21 Nov 2010 11:34:12 +0000 (11:34 +0000)
git-svn-id: https://svn.code.sf.net/p/freertos/code/trunk@1149 1d2547de-c912-0410-9cb9-b8ca96c0e9e2

Source/portable/MSVC-MingW/port.c

index 35f3c95c930cb784df6704ceeaafd088ecb2dfda..f89b2d0818fdfb0e77b37e6bacf4aab81730c0a1 100644 (file)
@@ -532,4 +532,19 @@ long lMutexNeedsReleasing;
                ReleaseMutex( pvInterruptEventMutex );\r
        }\r
 }\r
+/*-----------------------------------------------------------*/\r
+\r
+void vPortCheckCorrectThreadIsRunning( void )\r
+{\r
+xThreadState *pxThreadState = ( xThreadState * ) *( ( unsigned long * ) pxCurrentTCB );\r
+\r
+       /* When switching threads, Windows does not always seem to run the selected\r
+       thread immediately.  This function can be called to check if the thread\r
+       that is currently running is the thread that is responsible for executing\r
+       the task selected by the real time scheduler. */\r
+       if( GetCurrentThread() != pxThreadState->pvThread )\r
+       {\r
+               SwitchToThread();\r
+       }\r
+}\r
 \r