Skip to content

Commit

Permalink
Spinlocks already come initialized. Remove the code that would essent…
Browse files Browse the repository at this point in the history
…ially re-initialize them at runtime
  • Loading branch information
Spritetm committed Sep 23, 2016
1 parent d63dac0 commit b8bfa9f
Showing 1 changed file with 1 addition and 19 deletions.
20 changes: 1 addition & 19 deletions components/freertos/tasks.c
Original file line number Diff line number Diff line change
Expand Up @@ -275,9 +275,7 @@ when the scheduler is unsuspended. The pending ready list itself can only be
accessed from a critical section. */
PRIVILEGED_DATA static volatile UBaseType_t uxSchedulerSuspended[ portNUM_PROCESSORS ] = { ( UBaseType_t ) pdFALSE };

/* Muxes used in the task code */
PRIVILEGED_DATA static portBASE_TYPE xMutexesInitialised = pdFALSE;
/* For now, we use just one mux for all the critical sections. ToDo: give evrything a bit more granularity;
/* For now, we use just one mux for all the critical sections. ToDo: give everything a bit more granularity;
that could improve performance by not needlessly spinning in spinlocks for unrelated resources. */
PRIVILEGED_DATA static portMUX_TYPE xTaskQueueMutex = portMUX_INITIALIZER_UNLOCKED;
PRIVILEGED_DATA static portMUX_TYPE xTickCountMutex = portMUX_INITIALIZER_UNLOCKED;
Expand Down Expand Up @@ -577,15 +575,6 @@ static void prvResetNextTaskUnblockTime( void );

#endif

/*-----------------------------------------------------------*/


static void vTaskInitializeLocalMuxes( void )
{
vPortCPUInitializeMutex(&xTaskQueueMutex);
vPortCPUInitializeMutex(&xTickCountMutex);
xMutexesInitialised = pdTRUE;
}

/*-----------------------------------------------------------*/

Expand All @@ -596,9 +585,6 @@ TCB_t * pxNewTCB;
StackType_t *pxTopOfStack;
BaseType_t i;

/* Initialize mutexes, if they're not already initialized. */
if (xMutexesInitialised == pdFALSE) vTaskInitializeLocalMuxes();

configASSERT( pxTaskCode );
configASSERT( ( ( uxPriority & ( ~portPRIVILEGE_BIT ) ) < configMAX_PRIORITIES ) );
configASSERT( (xCoreID>=0 && xCoreID<portNUM_PROCESSORS) || (xCoreID==tskNO_AFFINITY) );
Expand Down Expand Up @@ -1725,10 +1711,6 @@ BaseType_t xAlreadyYielded = pdFALSE;
scheduler has been resumed it is safe to move all the pending ready
tasks from this list into their appropriate ready list. */

//This uses a mux, but can be called before tasks are scheduled. Make sure muxes are inited.
/* Initialize mutexes, if they're not already initialized. */
if (xMutexesInitialised == pdFALSE) vTaskInitializeLocalMuxes();

taskENTER_CRITICAL(&xTaskQueueMutex);
{
--uxSchedulerSuspended[ xPortGetCoreID() ];
Expand Down

0 comments on commit b8bfa9f

Please sign in to comment.