Quality RTOS & Embedded Software

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


A synchronization barrier

Posted by Martin Velek on August 24, 2009

how is the simplest implementation of barrier in FreeRTOS? I mean situation when a task is waiting for two or more events to continue. Having two or more semaphores/mutexes is not memory effective(some post notes that for one semaphore a 100 byte is requested).
I think that vSemaphoreCreateCounting() cannot be used for this purpose because a task is waken if the value is != 0.

Thank you for your advice.

If it is not possible I would suggest this feature.
xSemaphoreCreateBarrier( unsigned portBASE_TYPE uxMaxCount, unsigned portBASE_TYPE uxInitialCount). If a this type of semaphore is taken, the task will wait until uxInitialCount == uxMaxCount.

RE: A synchronization barrier

Posted by sotd on August 24, 2009
How about define integer to hold bit flags, one event for a bit, then use semaphore to block. When task unblock check integer to see if events happened and if no block again. ?

RE: A synchronization barrier

Posted by Martin Velek on August 25, 2009
Thank you vm. It seems to be working but I would rather use "n" integers, every for one event to avoid protecting bit flag itself or entering critical section. E.g. for n = 2, while(a == 0 || b==0) {semTake()}.

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

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

Latest News

FreeRTOS v10.2.1 is available for immediate download. MIT licensed, includes 64-bit RISC-V, NXP Cortex-M33 demo, Nuvoton Cortex-M23 demo & STM32H745 dual core (AMP) demo.

NXP tweet showing LPC5500 (ARMv8-M Cortex-M33) running FreeRTOS.

View a recording of the "OTA Update Security and Reliability" webinar, presented by TI and AWS.


FreeRTOS and other embedded software careers at AWS.

FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Cadence Tensilica Cortes

Espressif ESP32

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

Xilinx Microblaze and Zynq partner