From: richardbarry Date: Tue, 24 Apr 2012 13:09:22 +0000 (+0000) Subject: Change the Win32 port layer so it doesn't use the traceTASK_DELETE macro, but instead... X-Git-Tag: V7.1.1~4 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=746ef93129b6a4c91bcc42e9bf72c2db2f91f9bb;p=freertos Change the Win32 port layer so it doesn't use the traceTASK_DELETE macro, but instead the new portCLEAN_UP_TCB macro. git-svn-id: https://svn.code.sf.net/p/freertos/code/trunk@1745 1d2547de-c912-0410-9cb9-b8ca96c0e9e2 --- diff --git a/Source/portable/MSVC-MingW/port.c b/Source/portable/MSVC-MingW/port.c index 55d2ebe3c..b4d32f270 100644 --- a/Source/portable/MSVC-MingW/port.c +++ b/Source/portable/MSVC-MingW/port.c @@ -1,5 +1,5 @@ /* - FreeRTOS V7.1.0 - Copyright (C) 2011 Real Time Engineers Ltd. + FreeRTOS V7.1.1-rc1 - Copyright (C) 2011 Real Time Engineers Ltd. *************************************************************************** @@ -77,7 +77,6 @@ static void prvProcessSimulatedInterrupts( void ); * Interrupt handlers used by the kernel itself. These are executed from the * simulated interrupt handler thread. */ -static unsigned long prvProcessDeleteThreadInterrupt( void ); static unsigned long prvProcessYieldInterrupt( void ); static unsigned long prvProcessTickInterrupt( void ); @@ -150,7 +149,7 @@ portTickType xMinimumWindowsBlockTime = ( portTickType ) 20; { Sleep( portTICK_RATE_MS ); } - + WaitForSingleObject( pvInterruptEventMutex, INFINITE ); /* The timer has expired, generate the simulated tick event. */ @@ -204,7 +203,6 @@ xThreadState *pxThreadState; /* Install the interrupt handlers used by the scheduler itself. */ vPortSetInterruptHandler( portINTERRUPT_YIELD, prvProcessYieldInterrupt ); vPortSetInterruptHandler( portINTERRUPT_TICK, prvProcessTickInterrupt ); - vPortSetInterruptHandler( portINTERRUPT_DELETE_THREAD, prvProcessDeleteThreadInterrupt ); /* Create the events and mutexes that are used to synchronise all the threads. */ @@ -270,12 +268,6 @@ xThreadState *pxThreadState; } /*-----------------------------------------------------------*/ -static unsigned long prvProcessDeleteThreadInterrupt( void ) -{ - return pdTRUE; -} -/*-----------------------------------------------------------*/ - static unsigned long prvProcessYieldInterrupt( void ) { return pdTRUE; @@ -361,15 +353,7 @@ void *pvObjectList[ 2 ]; { /* Suspend the old thread. */ pxThreadState = ( xThreadState *) *( ( unsigned long * ) pvOldCurrentTCB ); - - if( ( ulSwitchRequired & ( 1 << portINTERRUPT_DELETE_THREAD ) ) != pdFALSE ) - { - TerminateThread( pxThreadState->pvThread, 0 ); - } - else - { - SuspendThread( pxThreadState->pvThread ); - } + SuspendThread( pxThreadState->pvThread ); /* Obtain the state of the task now selected to enter the Running state. */ @@ -387,23 +371,13 @@ void vPortDeleteThread( void *pvTaskToDelete ) { xThreadState *pxThreadState; - if( pvTaskToDelete == pxCurrentTCB ) - { - /* The task is deleting itself, and so the thread that is running now - is also to be deleted. This has to be deferred until this thread is - no longer running, so its done in the simulated interrupt handler thread. */ - vPortGenerateSimulatedInterrupt( portINTERRUPT_DELETE_THREAD ); - } - else - { - WaitForSingleObject( pvInterruptEventMutex, INFINITE ); + WaitForSingleObject( pvInterruptEventMutex, INFINITE ); - /* Find the handle of the thread being deleted. */ - pxThreadState = ( xThreadState * ) ( *( unsigned long *) pvTaskToDelete ); - TerminateThread( pxThreadState->pvThread, 0 ); + /* Find the handle of the thread being deleted. */ + pxThreadState = ( xThreadState * ) ( *( unsigned long *) pvTaskToDelete ); + TerminateThread( pxThreadState->pvThread, 0 ); - ReleaseMutex( pvInterruptEventMutex ); - } + ReleaseMutex( pvInterruptEventMutex ); } /*-----------------------------------------------------------*/ diff --git a/Source/portable/MSVC-MingW/portmacro.h b/Source/portable/MSVC-MingW/portmacro.h index c8529e156..5e7bf688c 100644 --- a/Source/portable/MSVC-MingW/portmacro.h +++ b/Source/portable/MSVC-MingW/portmacro.h @@ -1,5 +1,5 @@ /* - FreeRTOS V7.1.0 - Copyright (C) 2011 Real Time Engineers Ltd. + FreeRTOS V7.1.1-rc1 - Copyright (C) 2011 Real Time Engineers Ltd. *************************************************************************** @@ -84,7 +84,7 @@ #define portYIELD() vPortGenerateSimulatedInterrupt( portINTERRUPT_YIELD ) void vPortDeleteThread( void *pvThreadToDelete ); -#define traceTASK_DELETE( pxTCB ) vPortDeleteThread( pxTCB ) +#define portCLEAN_UP_TCB( pxTCB ) vPortDeleteThread( pxTCB ) #define portDISABLE_INTERRUPTS() #define portENABLE_INTERRUPTS() @@ -102,7 +102,6 @@ void vPortExitCritical( void ); #define portINTERRUPT_YIELD ( 0UL ) #define portINTERRUPT_TICK ( 1UL ) -#define portINTERRUPT_DELETE_THREAD ( 2UL ) /* * Raise a simulated interrupt represented by the bit mask in ulInterruptMask.