Quality RTOS & Embedded Software

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




Loading

Queues & threads

Posted by ta8086 on October 15, 2013

I have 2 questions:

1) Is it safe to use functions *FromISR outside of interrupt routine i.e. in normal task which can be switchedin the middle of FromISR API? I need xQueueIsQueueFullFromISR but it does not have normal API.

2) I have this situation:

  • thread 1 which is frequently blocked with xQueueSelectFromSet;
  • thread 2 adds data in a queue with xQueueSend( ..., portMAX_DELAY );
  • the queue is joined to queue set above;

Is there a chance to get dead lock if thread 1 is blocked, the corresponding queue is full and xQueueSend hang without unblocking thread 1? In other words - when the queue is full and thread blocked for some reason, will the xQueueSend unblock the thread and continue waiting for empty element in queue?


Queues & threads

Posted by richardbarry on October 16, 2013

Whether or not you can use the "FromISR" functions outside of interrupts is somewhat dependent on the port. It is something I do myself as an optimisation sometimes, but generally I would not advise it to people who are not advanced users. If you are using a recent version of FreeRTOS on a Cortex-M device, you should be ok.

FreeRTOS V7.5.3 has a new API function uxQueueSpacesAvailable() which returns the number of spaces in the queue. That will do what you want I think.

You should not get deadlocks in your scenario - but be sure to follow the instructions on using queue sets with regards to ensuring the queue size of the queue set is at least equal to the sum of the sizes (that is, the maximum number of items that can be held within) of the queues added to the set.

Regards.


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




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

Latest News

FreeRTOS kernel V10 is available for immediate download. Now MIT licensed.


FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

IAR Partner

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

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