Lines Matching refs:sem
68 int sem_init(sem_t *sem, int shared, unsigned int value)
74 if ((sem == NULL) || (value >= OS_SEM_COUNTING_MAX_COUNT)) {
85 sem->s_magic = (INT32)_SEM_MAGIC;
86 sem->s_handle = (INT32)semHandle;
91 int sem_destroy(sem_t *sem)
95 if ((sem == NULL) || (sem->s_magic != (INT32)_SEM_MAGIC)) {
100 ret = LOS_SemDelete((UINT32)sem->s_handle);
109 int sem_wait(sem_t *sem)
113 if ((sem == NULL) || (sem->s_magic != (INT32)_SEM_MAGIC)) {
118 ret = LOS_SemPend((UINT32)sem->s_handle, LOS_WAIT_FOREVER);
127 int sem_post(sem_t *sem)
131 if ((sem == NULL) || (sem->s_magic != (INT32)_SEM_MAGIC)) {
136 ret = LOS_SemPost((UINT32)sem->s_handle);
145 int sem_trywait(sem_t *sem)
149 if ((sem == NULL) || (sem->s_magic != (INT32)_SEM_MAGIC)) {
154 ret = LOS_SemPend((UINT32)sem->s_handle, LOS_NO_WAIT);
163 int sem_timedwait(sem_t *sem, const struct timespec *timeout)
168 if ((sem == NULL) || (sem->s_magic != (INT32)_SEM_MAGIC)) {
183 ret = LOS_SemPend((UINT32)sem->s_handle, (UINT32)tickCnt);
192 int sem_getvalue(sem_t *sem, int *currVal)
196 if ((sem == NULL) || (sem->s_magic != (INT32)_SEM_MAGIC)|| (currVal == NULL)) {
201 ret = LOS_SemGetValue(sem->s_handle, currVal);