From 6fc5fdbdc70dd17ea8e681a361fb4dae541ee953 Mon Sep 17 00:00:00 2001 From: Rich Felker Date: Fri, 4 Mar 2011 00:45:59 -0500 Subject: implement POSIX semaphores --- src/thread/sem_post.c | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 src/thread/sem_post.c (limited to 'src/thread/sem_post.c') 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 +#include "pthread_impl.h" + +int sem_post(sem_t *sem) +{ + if (!a_fetch_add(sem->__val, 1)) + __wake(sem->__val, 1, 0); + return 0; +} -- cgit v1.2.1