RTOS/RTX: Prevent to release more semaphore than the number of resource#13
RTOS/RTX: Prevent to release more semaphore than the number of resource#13oliviermartin wants to merge 1 commit intoARM-software:masterfrom
Conversation
Prior to this change, calling osSemaphoreRelease() too many time will allocate additional resource to the initial number of resources.
|
I think that limiting the maximum number of tokens to the initial value is no good idea. There are scenarios where it is possible that the semaphore count increases past its initial value. Take a producer-consumer setup as an example. Whenever the producer finishes its work, it puts the result into a queue and increases a semaphore with In my opinion, calling the function So I think, this patch was much more useful, if |
|
One more thing: When introducing an upper limit for the semaphore, one should also re-think the behavior of |
|
@ombre5733 is right, If you really need a |
Prior to this change, calling osSemaphoreRelease() too many time
will allocate additional resource to the initial number of resources.