[libc-commits] [libc] [libc][semaphore] Add unnamed semaphore implementation (PR #190851)
Michael Jones via libc-commits
libc-commits at lists.llvm.org
Wed Apr 8 13:26:44 PDT 2026
================
@@ -0,0 +1,20 @@
+//===-- Definition of sem_t type -----------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIBC_TYPES_SEM_T_H
+#define LLVM_LIBC_TYPES_SEM_T_H
+
+#include "__futex_word.h"
+
+typedef struct {
+ __futex_word __value; // current semaphore count
+ unsigned int __canary; // used for sanity check
+ unsigned char __reserved[8]; // for future usage, total fixed size 16 bytes
----------------
michaelrj-google wrote:
if the intent is to guarantee a size of 16 bytes then int and char should be replaced with `uint32_t` and `uint8_t`.
https://github.com/llvm/llvm-project/pull/190851
More information about the libc-commits
mailing list