1*0Sigor@sysoev.ru 2*0Sigor@sysoev.ru /* 3*0Sigor@sysoev.ru * Copyright (C) Igor Sysoev 4*0Sigor@sysoev.ru * Copyright (C) NGINX, Inc. 5*0Sigor@sysoev.ru */ 6*0Sigor@sysoev.ru 7*0Sigor@sysoev.ru #ifndef _NXT_UNIX_SEMAPHORE_H_INCLUDED_ 8*0Sigor@sysoev.ru #define _NXT_UNIX_SEMAPHORE_H_INCLUDED_ 9*0Sigor@sysoev.ru 10*0Sigor@sysoev.ru 11*0Sigor@sysoev.ru #if (NXT_HAVE_SEM_TIMEDWAIT) 12*0Sigor@sysoev.ru 13*0Sigor@sysoev.ru typedef sem_t nxt_sem_t; 14*0Sigor@sysoev.ru 15*0Sigor@sysoev.ru #else 16*0Sigor@sysoev.ru 17*0Sigor@sysoev.ru typedef struct { 18*0Sigor@sysoev.ru nxt_atomic_t count; 19*0Sigor@sysoev.ru nxt_thread_mutex_t mutex; 20*0Sigor@sysoev.ru nxt_thread_cond_t cond; 21*0Sigor@sysoev.ru } nxt_sem_t; 22*0Sigor@sysoev.ru 23*0Sigor@sysoev.ru #endif 24*0Sigor@sysoev.ru 25*0Sigor@sysoev.ru 26*0Sigor@sysoev.ru NXT_EXPORT nxt_int_t nxt_sem_init(nxt_sem_t *sem, nxt_uint_t count); 27*0Sigor@sysoev.ru NXT_EXPORT void nxt_sem_destroy(nxt_sem_t *sem); 28*0Sigor@sysoev.ru NXT_EXPORT nxt_int_t nxt_sem_post(nxt_sem_t *sem); 29*0Sigor@sysoev.ru NXT_EXPORT nxt_err_t nxt_sem_wait(nxt_sem_t *sem, nxt_nsec_t timeout); 30*0Sigor@sysoev.ru 31*0Sigor@sysoev.ru 32*0Sigor@sysoev.ru #endif /* _NXT_UNIX_SEMAPHORE_H_INCLUDED_ */ 33