From 327645436ae6baa2166e6c3dd9856cba03ce5e3f Mon Sep 17 00:00:00 2001 From: Nikita Smith Date: Mon, 13 Oct 2025 16:17:37 -0700 Subject: [PATCH] named semaphore impl for Linux --- src/os/core/linux/os_core_linux.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/os/core/linux/os_core_linux.c b/src/os/core/linux/os_core_linux.c index 9b137287..b254cf17 100644 --- a/src/os/core/linux/os_core_linux.c +++ b/src/os/core/linux/os_core_linux.c @@ -1059,8 +1059,19 @@ os_semaphore_alloc(U32 initial_count, U32 max_count, String8 name) Semaphore result = {0}; if (name.size > 0) { - // TODO: we need to allocate shared memory to store sem_t - // NotImplemented; + for EachIndex(attempt_idx, 64) + { + sem_t *s = sem_open((char *)name.str, O_CREAT | O_EXCL, 0666, initial_count); + if(s == SEM_FAILED) + { + s = sem_open((char *)name.str, 0); + } + if(s != SEM_FAILED) + { + result.u64[0] = (U64)s; + break; + } + } } else {