mirror of
https://github.com/apache/nuttx.git
synced 2026-05-20 04:16:35 +08:00
sched/semaphore: correct the return value of sem_post()
sem_post() should return EOVERFLOW if maximum allowable value for a semaphore would be exceeded. Reference: https://man7.org/linux/man-pages/man3/sem_post.3.html Signed-off-by: chao an <anchao@xiaomi.com>
This commit is contained in:
committed by
Masayuki Ishikawa
parent
b9d70365a1
commit
45e4bc5f33
@@ -89,7 +89,11 @@ int nxsem_post(FAR sem_t *sem)
|
||||
|
||||
/* Check the maximum allowable value */
|
||||
|
||||
DEBUGASSERT(sem_count < SEM_VALUE_MAX);
|
||||
if (sem_count >= SEM_VALUE_MAX)
|
||||
{
|
||||
leave_critical_section(flags);
|
||||
return -EOVERFLOW;
|
||||
}
|
||||
|
||||
/* Perform the semaphore unlock operation, releasing this task as a
|
||||
* holder then also incrementing the count on the semaphore.
|
||||
|
||||
Reference in New Issue
Block a user