sem_post.c 152 B

123456789
  1. #include <semaphore.h>
  2. #include "pthread_impl.h"
  3. int sem_post(sem_t *sem)
  4. {
  5. if (!a_fetch_add(sem->__val, 1))
  6. __wake(sem->__val, 1, 0);
  7. return 0;
  8. }