Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem


Loading

optimisaztion in xQueueSend and xQueueReceive

Posted by Nobody/Anonymous on June 23, 2005
at line 349 and line 474 in queue.c , there is the same code below:

if( prvUnlockQueue( pxQueue ) )
{
if( !xTaskResumeAll() )
{
taskYIELD();
}
}
else
{
xTaskResumeAll();
}

But i think in these code if prvUnlockQueue( pxQueue ) return pdTRUE then xTaskResumeAll() must return pdTRUE( if scheduler is not locket nested) , so it's meaningless to do taskYIELD(). So these code can be changed to:

prvUnlockQueue( pxQueue ) ;
xTaskResumeAll();

RE: optimisaztion in xQueueSend and xQueueReceive

Posted by Richard on June 23, 2005
This is the most complex part of the code. Everything is geared at ensuring interrupts are disabled for the shortest possible period.

You might be right in your comment - with the scheduler suspended unlocking the queue can only move items to the pending ready list - where they will be removed by xTaskResumeAll().

I know there was a lot of thought that went into this code sequence. It was originally as per or similar to your suggestion. This one will take a bit of digging time for me to find why the change was made. It will be good to look again at this in detail. Out of interest I will run a few black box style tests to see if they ever fail with the change.

In any case the optimisation saving would be minimal - with a couple of tests being removed.

Regards.


[ Back to the top ]    [ About FreeRTOS ]    [ Privacy ]    [ Sitemap ]    [ ]


Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.

Latest News

NXP tweet showing LPC5500 (ARMv8-M Cortex-M33) running FreeRTOS.

Meet Richard Barry and learn about running FreeRTOS on RISC-V at FOSDEM 2019

Version 10.1.1 of the FreeRTOS kernel is available for immediate download. MIT licensed.

View a recording of the "OTA Update Security and Reliability" webinar, presented by TI and AWS.


Careers

FreeRTOS and other embedded software careers at AWS.



FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Espressif ESP32

IAR Partner

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

Renesas

STMicro RTOS partner supporting ARM7, ARM Cortex-M3, ARM Cortex-M4 and ARM Cortex-M0

Texas Instruments MCU Developer Network RTOS partner for ARM and MSP430 microcontrollers

OpenRTOS and SafeRTOS

Xilinx Microblaze and Zynq partner