mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-28 11:23:34 +08:00
POSIX: Add sem_getvalue() abstraction
This commit is contained in:
@@ -85,6 +85,16 @@ int px4_sem_post(px4_sem_t *s)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int px4_sem_getvalue(px4_sem_t *s)
|
||||
{
|
||||
int val;
|
||||
pthread_mutex_lock(&(s->lock));
|
||||
val = s->value;
|
||||
pthread_mutex_unlock(&(s->lock));
|
||||
|
||||
return val;
|
||||
}
|
||||
|
||||
int px4_sem_destroy(px4_sem_t *s)
|
||||
{
|
||||
pthread_mutex_lock(&(s->lock));
|
||||
|
||||
Reference in New Issue
Block a user