Semaphore does not use max_count #3
Labels
bug
Something isn't working
internal bug tracker
Issue confirmed and reported into a ticket in the internal bug tracking system
mw
MW-related issue or pull-request
rtos
RTOS-related issue or pull-request
Caution
The Issues are strictly limited for the reporting of problem encountered with the software provided in this project.
For any other problem related to the STM32 product, the performance, the hardware characteristics and boards, the tools the environment in general, please post your report to the ST Community in the STM32 MCUs dedicated page.
Describe the set-up
any
Describe the bug (skip if none)
The CMSIS RTOS API for semaphores requires the parameter
max_count
for maximum number of available tokens. The current implementation however ignores this parameter making it impossible to use binary semaphores per example.In
osSemaphoreRelease()
, thetx_semaphore_put()
is used to release the semaphore tokens. however, this function does not account formax_count
. IfosSemaphoreRelease()
is called more often thanmax_count
specifies, the internal token count will exceedmax_count
, leading to more tokens being available, when acquireing the semaphore.How to reproduce the bug (skip if none)
osSemaphoreId_t semaphore = osSemaphoreNew(1, 1, NULL);
osSemaphoreRelease(semaphore);
osSemaphoreAcquire(semaphore, 100);
Additional context
our quick fix semaphore_max_count.patch
Screenshots
n/a
The text was updated successfully, but these errors were encountered: