diff options
Diffstat (limited to 'include/bh/thread.h')
| -rw-r--r-- | include/bh/thread.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/include/bh/thread.h b/include/bh/thread.h index 3ec037f..cfc02e8 100644 --- a/include/bh/thread.h +++ b/include/bh/thread.h @@ -8,6 +8,7 @@ typedef void (*bh_thread_cb_t)(void *); typedef struct bh_thread_s bh_thread_t; typedef struct bh_mutex_s bh_mutex_t; +typedef struct bh_semaphore_s bh_semaphore_t; typedef struct bh_cond_s bh_cond_t; typedef struct bh_task_s bh_task_t; typedef struct bh_thread_pool_s bh_thread_pool_t; @@ -189,6 +190,14 @@ int bh_mutex_try_lock(bh_mutex_t *mutex); */ int bh_mutex_unlock(bh_mutex_t *mutex); +bh_semaphore_t *bh_semaphore_new(int count); +void bh_semaphore_free(bh_semaphore_t *semaphore); +int bh_semaphore_post(bh_semaphore_t *semaphore); +int bh_semaphore_wait(bh_semaphore_t *semaphore); +int bh_semaphore_wait_for(bh_semaphore_t *semaphore, + unsigned long timeout); +int bh_semaphore_try_wait(bh_semaphore_t *semaphore); + /** * @brief Create condition variable. * |
