semaphore.h 736 B

1234567891011121314151617181920212223242526272829303132333435
  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. #ifdef __cplusplus
  26. }
  27. #endif
  28. #endif