aboutsummaryrefslogtreecommitdiff
path: root/src/thread.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/thread.c')
-rw-r--r--src/thread.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/thread.c b/src/thread.c
index 77f36bb..84bc2c0 100644
--- a/src/thread.c
+++ b/src/thread.c
@@ -68,6 +68,26 @@ void bh_mutex_free(bh_mutex_t *mutex)
free(mutex);
}
+bh_semaphore_t *bh_semaphore_new(int count)
+{
+ bh_semaphore_t *result;
+
+ result = malloc(sizeof(*result));
+ if (result && bh_semaphore_init(result, count))
+ {
+ free(result);
+ result = NULL;
+ }
+
+ return result;
+}
+
+void bh_semaphore_free(bh_semaphore_t *semaphore)
+{
+ bh_semaphore_destroy(semaphore);
+ free(semaphore);
+}
+
bh_cond_t *bh_cond_new(void)
{
bh_cond_t *result;