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 2012 Threads] Clearing a counting semaphore.Posted by Corey Paye on August 31, 2012 I am using Free RTOS v7.02 and am relatively new to it. I am considering using a counting semaphore as a way of counting the number of interrupts that occur in a fixed period of time. However there is a chance that I cannot "take" all of the accumulated semaphore counts before a separate part of the program takes over. Is there a way to clear the accumulated counts? Deleting the semaphore would not work because a task will be blocked on it. I know that the queue management api has a "QueueReset" function but I could not find anything similar in the semaphore/mutex api.
Thanks.
RE: Clearing a counting semaphore.Posted by Richard on August 31, 2012 You can pass your semaphore handle into the queue reset function. Just cast the xSemaphoreHandle to an xQueueHandle if the compiler generates a warning about the type mismatch.
However, xQueueReset() was only introduced in V7.1.1, and even then it will not let you reset a queue/semaphore when tasks are blocked on it. V7.2.0 will allow queues that have tasks blocked on them to be reset.
Regards.
RE: Clearing a counting semaphore.Posted by Corey Paye on August 31, 2012 Thanks for the feedback. What you say makes sense. Unfortunately I cannot change RTOS versions at this point.
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.
|