diff options
Diffstat (limited to 'include/bh/thread.h')
| -rw-r--r-- | include/bh/thread.h | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/include/bh/thread.h b/include/bh/thread.h index 22bdf30..3360c42 100644 --- a/include/bh/thread.h +++ b/include/bh/thread.h @@ -12,6 +12,7 @@ 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; +typedef struct bh_spinlock_s bh_spinlock_t; #if defined(BH_USE_PTHREAD) bh_thread_t *bh_thread_new(bh_task_t *task); @@ -108,4 +109,20 @@ int bh_thread_pool_wait(bh_thread_pool_t *pool); void bh_thread_pool_free(bh_thread_pool_t *pool); +bh_spinlock_t *bh_spinlock_new(void); + +void bh_spinlock_free(bh_spinlock_t *lock); + +int bh_spinlock_lock(bh_spinlock_t *lock); + +int bh_spinlock_unlock(bh_spinlock_t *lock); + +int bh_spinlock_try_lock(bh_spinlock_t *lock); + +int bh_tls_alloc(bh_generic_cb_t cleanup); + +void *bh_tls_get(int slot); + +void bh_tls_set(int slot, void* data); + #endif /* BH_THREAD_H */ |
