semaphore.h 810 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. #ifndef _SEMAPHORE_H
  2. #define _SEMAPHORE_H
  3. #ifdef __cplusplus
  4. extern "C" {
  5. #endif
  6. #include <features.h>
  7. #define __NEED_time_t
  8. #define __NEED_struct_timespec
  9. #include <bits/alltypes.h>
  10. #include <fcntl.h>
  11. #define SEM_FAILED ((sem_t *)0)
  12. typedef struct {
  13. volatile int __val[4*sizeof(long)/sizeof(int)];
  14. } sem_t;
  15. int sem_close(sem_t *);
  16. int sem_destroy(sem_t *);
  17. int sem_getvalue(sem_t *__restrict, int *__restrict);
  18. int sem_init(sem_t *, int, unsigned);
  19. sem_t *sem_open(const char *, int, ...);
  20. int sem_post(sem_t *);
  21. int sem_timedwait(sem_t *__restrict, const struct timespec *__restrict);
  22. int sem_trywait(sem_t *);
  23. int sem_unlink(const char *);
  24. int sem_wait(sem_t *);
  25. #if _REDIR_TIME64
  26. __REDIR(sem_timedwait, __sem_timedwait_time64);
  27. #endif
  28. #ifdef __cplusplus
  29. }
  30. #endif
  31. #endif