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




Loading

Deleting queue task waiting on OK?

Posted by JC on October 26, 2008
If task A is writing to a queue with portMAX_DELAY as the timeout, and the task blocks because the queue is full, what happens when task B deletes the queue with vQueueDelete()?

I probably missed something looking through the source code, but I would think if that xTasksWaitingToSend and xTasksWaitingToReceive lists should be evaluated and the corresponding tasks returned a non-pdPASS return value.

My scenario is that I have a uIP telnetd task that sends and receives via queues to the higher priority monitor task. If printf() from the monitor tasks blocks because the uIP buffers are full, and the socket is subsequently closed, it would appear that because the waiting task is never signaled the queue has been deleted, that the system will deadlock since the uIP task will never clean out the queue.

The monitor runs at a higher task so that the uIP task can be killed from the console. The console should always have control, regardless of what other tasks may have a seizure, which the exception of an exception that requires a reset.

I suppose it might be possible to have uIP close socket process repeatedly read the queue with a wait time of 0 until nothing is returned.

All this is sub-ideal. It'd be better to have the uIP telnetd task run its own instance of the command interpreter. This gets rather problematic with the protosockets implementation, and all it's squirrely little rules that it seems to have about tasks blocking. And the newlib/syscalls implementation gets complimicated since it now has to become much more telnet aware. As it is, it appears the best way is to use a couple queues to pass commands and output back and forth, and have uIP use xQueuePeek() to avoid blocking.

I'm open to suggestions on this. I may be approaching this from a bad angle.

--jc

RE: Deleting queue task waiting on OK?

Posted by Richard on October 26, 2008
The way the code is currently you cannot delete a queue that has tasks blocked on it. The QueueDelete function just frees the heap RAM it grabbed when it was created. The best solution might be to extend the queue delete function to unblock tasks first, but this too would be problematic as the tasks would be in a confused state if they unblocked without having either completed their block period or successfully accessed the queue (they would in fact just attempt to block again within the API function itself).


[ 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