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] [November 2008 Threads] Question/Suggestion for SemaphoresPosted by bodev on November 20, 2008 Hi all, i am using a semaphore and one task and ISR communicate with that.
In my app, as suggested in FreeRTOS doc, the ISR always give the semaphore and the task always take it. however, the first interaction of the task the semaphore is already given by the creation function and not by the ISR. This cause not correct exectution.
I noticed that in the creation (vSemaphoreCreateBinary) the semaphore is automatically "given" (xSemaphoreGive).
This problem is easily solvable by "taking" the semaphore just after creation, but it might be a good idea to have a parameter in vSemaphoreCreateBinary in order for the developer to choose if the created semapore should be given or not. or at least document this.
Am i correct? any comments?
thanks Bo
RE: Question/Suggestion for SemaphoresPosted by Dave on November 21, 2008 Your suggestion is valid but it would have to be done in a way that was backward compatible. Maybe maintain the original function to create the semaphore and introduce a new function that has the extra parameter.
RE: Question/Suggestion for SemaphoresPosted by saiberion on November 21, 2008 by the way, what is the reason that a semaphore is given on creation?
RE: Question/Suggestion for SemaphoresPosted by Jesper Matthiesen on November 21, 2008 i wondered about that on several occasions as well.. appears more natural that it is initially "taken" i would think...
RE: Question/Suggestion for SemaphoresPosted by Martin Velek on November 23, 2008 Hi,
I was wondering too, so I replaced classic binary semaphore with counting semaphore
UARTTxBinSemaphore = xSemaphoreCreateCounting( 1, 0 );
Martin
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.
|