Quality RTOS & Embedded Software

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


Nonblocking mutex take from ISR

Posted by Kevin on November 14, 2012
I understand that ISRs cannot block waiting on mutexes. However, I would like to take a mutex in an ISR only if it is available, and not otherwise. This is equivalent to pthread_mutex_trylock in posix threads. Is it safe to call xSemaphoreTake with a timeout of 0 from an ISR in all cases? I'm not sure why this wouldn't work, but the API reference says it doesn't. Is there another way to handle this? Or is this operation unsupported by FreeRTOS?

Thank you,

RE: Nonblocking mutex take from ISR

Posted by MEdwards on November 14, 2012
FreeRTOS V7.2.0 (it is not on 7.3.0) added an xSemaphoreTakeFromISR() function. Use with caution on a mutex type sempahore as I don't know the implications on priority inheritance. It might be ok, I don't know. Richard?

[ 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