• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #ifndef _SEMAPHORE_H
2 #define _SEMAPHORE_H
3 #ifdef __cplusplus
4 extern "C" {
5 #endif
6 
7 #include <features.h>
8 
9 #define __NEED_time_t
10 #define __NEED_struct_timespec
11 #include <bits/alltypes.h>
12 
13 #include <fcntl.h>
14 
15 #define SEM_FAILED ((sem_t *)0)
16 
17 #ifndef __LITEOS__
18 typedef struct {
19 	volatile int __val[4*sizeof(long)/sizeof(int)];
20 } sem_t;
21 #else
22 #include "los_sem_pri.h"
23 
24 /**
25  * @ingroup semaphore
26  * API parameter sructure
27  */
28 typedef struct posix_sem {
29 	LosSemCB *sem;
30 } sem_t;
31 #endif
32 
33 int    sem_close(sem_t *);
34 int    sem_destroy(sem_t *);
35 int    sem_getvalue(sem_t *__restrict, int *__restrict);
36 int    sem_init(sem_t *, int, unsigned);
37 sem_t *sem_open(const char *, int, ...);
38 int    sem_post(sem_t *);
39 int    sem_timedwait(sem_t *__restrict, const struct timespec *__restrict);
40 int    sem_trywait(sem_t *);
41 int    sem_unlink(const char *);
42 int    sem_wait(sem_t *);
43 
44 #if _REDIR_TIME64
45 __REDIR(sem_timedwait, __sem_timedwait_time64);
46 #endif
47 
48 #ifdef __cplusplus
49 }
50 #endif
51 #endif
52