Quality RTOS & Embedded Software

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


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.


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

Copyright (C) 2004-2010 Richard Barry. Copyright (C) 2010-2016 Real Time Engineers Ltd.
Any and all data, files, source code, html content and documentation included in the FreeRTOSTM distribution or available on this site are the exclusive property of Real Time Engineers Ltd.. See the files license.txt (included in the distribution) and this copyright notice for more information. FreeRTOSTM and FreeRTOS.orgTM are trade marks of Real Time Engineers Ltd.

Latest News:

FreeRTOS V9.0.0 is now available for download.

Free TCP/IP and file system demos for the RTOS

Sponsored Links

⇓ Now With No Code Size Limit! ⇓
⇑ Free Download Without Registering ⇑

FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Renesas Electronics Gold Alliance RTOS Partner.jpg

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

Atmel RTOS partner supporting ARM Cortex-M3 and AVR32 microcontrollers

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

Xilinx Microblaze and Zynq partner

Silicon Labs low power RTOS partner

Altera RTOS partner for Nios II and Cortex-A9 SoC

Freescale Alliance RTOS Member supporting ARM and ColdFire microcontrollers

Infineon ARM Cortex-M microcontrollers

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

Cypress RTOS partner supporting ARM Cortex-M3

Fujitsu RTOS partner supporting ARM Cortex-M3 and FM3

Microsemi (previously Actel) RTOS partner supporting ARM Cortex-M3

Atollic Partner

IAR Partner

Keil ARM Partner

Embedded Artists