POSIX: Add sem_getvalue() abstraction

This commit is contained in:
Lorenz Meier
2015-09-19 18:24:14 +02:00
parent ef48715051
commit 50061a95a4
2 changed files with 12 additions and 0 deletions
+10
View File
@@ -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));