aboutsummaryrefslogtreecommitdiff
path: root/src/thread.c
diff options
context:
space:
mode:
authorMikhail Romanko <me@blankhex.com>2024-04-27 11:25:21 +0300
committerMikhail Romanko <me@blankhex.com>2024-04-27 14:40:32 +0300
commitfdbabab0e04fac2b5a84ea8e8088cd4767034a45 (patch)
treee346e1399afdcb40b1a25d04928d10712288b32c /src/thread.c
parentbc1d198c10a77d6e37c46fb0b9e3cb4fcb7c5f38 (diff)
downloadbhlib-old-fdbabab0e04fac2b5a84ea8e8088cd4767034a45.tar.gz
Implement WinNT condition variables, add semaphors
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;