FreeRTOS Support Archive
The FreeRTOS support forum is used to obtain active support directly from Real
Time Engineers Ltd. In return for using our top quality software and services for
free, we request you play fair and do your bit to help others too! Sign up
to receive notifications of new support topics then help where you can.
This is a read only archive of threads posted to the FreeRTOS support forum.
The archive is updated every week, so will not always contain the very latest posts.
Use these archive pages to search previous posts. Use the Live FreeRTOS Forum
link to reply to a post, or start a new support thread.
[FreeRTOS Home] [Live FreeRTOS Forum] [FAQ] [Archive Top] [August 2009 Threads] A synchronization barrierPosted by Martin Velek on August 24, 2009 Hello,
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.
P.S. 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 barrierPosted 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 barrierPosted 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()}.
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.
|