[libc-commits] [libc] [libc][POSIX][pthreads] implement pthread_condattr_t functions (PR #88987)
Nick Desaulniers via libc-commits
libc-commits at lists.llvm.org
Tue Apr 16 14:19:24 PDT 2024
================
@@ -0,0 +1,18 @@
+//===-- Definition of pthread_condattr_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_PTHREAD_CONDATTR_T_H
+#define LLVM_LIBC_TYPES_PTHREAD_CONDATTR_T_H
+
+#include "clockid_t.h"
+
+typedef struct {
+ clockid_t clock;
+ int pshared;
+} pthread_condattr_t;
----------------
nickdesaulniers wrote:
FWIW, POSIX doesn't really say what this opaque type needs to look like. It just needs to store a `clockid_t` (4 possible values, 2 bits of storage) and 1 bit for whether the condition variable is process shared or not.
Bionic packs this into a single long, and makes the fields opaque.
Do we use bitfields at all for our ABI? LLVM has ADT/BitFields.h which is really nice; folks have requested I use that class in LLVM in the past rather than vanilla C bitfields. IDK
https://github.com/llvm/llvm-project/pull/88987
More information about the libc-commits
mailing list