1 #ifndef _SEMAPHORE_H 2 #define _SEMAPHORE_H 3 #ifdef __cplusplus 4 extern "C" { 5 #endif 6 7 #include <sys/features.h> 8 #include <sys/types.h> 9 10 #include <time.h> 11 #include <fcntl.h> 12 #include "los_sem_pri.h" 13 14 #define SEM_FAILED ((sem_t *)0) 15 16 typedef struct posix_sem { 17 LosSemCB* sem; 18 } sem_t; 19 20 int sem_close(sem_t *); 21 int sem_destroy(sem_t *); 22 int sem_getvalue(sem_t *__restrict, int *__restrict); 23 int sem_init(sem_t *, int, unsigned); 24 sem_t *sem_open(const char *, int, ...); 25 int sem_post(sem_t *); 26 int sem_timedwait(sem_t *__restrict, const struct timespec *__restrict); 27 int sem_trywait(sem_t *); 28 int sem_unlink(const char *); 29 int sem_wait(sem_t *); 30 31 #if _REDIR_TIME64 32 __REDIR(sem_timedwait, __sem_timedwait_time64); 33 #endif 34 35 #ifdef __cplusplus 36 } 37 #endif 38 #endif 39