Implement WinNT condition variables, add semaphors

This commit is contained in:
2024-04-27 11:25:21 +03:00
parent bc1d198c10
commit fdbabab0e0
11 changed files with 515 additions and 52 deletions

View File

@@ -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.
*