summaryrefslogtreecommitdiff
path: root/src/thread/sem_post.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/thread/sem_post.c')
-rw-r--r--src/thread/sem_post.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/thread/sem_post.c b/src/thread/sem_post.c
new file mode 100644
index 00000000..0bd8a462
--- /dev/null
+++ b/src/thread/sem_post.c
@@ -0,0 +1,9 @@
+#include <semaphore.h>
+#include "pthread_impl.h"
+
+int sem_post(sem_t *sem)
+{
+ if (!a_fetch_add(sem->__val, 1))
+ __wake(sem->__val, 1, 0);
+ return 0;
+}