Quality RTOS & Embedded Software

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




Loading

Is it OK to use semph in vApplicationIdleHook

Posted by Robert H. Oujesky on May 18, 2011
Is it ok to do this in vApplicationIdleHook?

xSemaphoreTake(xSemaphore, portMAX_DELAY);
++ulIdleCycleCount;
xSemaphoreGive(xSemaphore);

I have another task which runs every second, prints the value of ulIdleCycleCount and then zeros it out. Before I do this, it looks like about every 5 seconds, it does not get zero'd out, but still gets printed....
I know you cant delay in the idle task.....

RE: Is it OK to use semph in vApplicationIdleHook

Posted by Richard Damon on May 19, 2011
No, the idle task, including the Idle Hook, may not Block. If the Idle task was to block, then the scheduler would not be able to find anything to run, and tends to just crash.

If you delay for 0, then it would be allowed, but then you would want to test for success before doing the give.

RE: Is it OK to use semph in vApplicationIdleHook

Posted by Robert H. Oujesky on May 20, 2011
thanks!


[ 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