1 //===-- Linux futex related definitions -------------------------*- C++ -*-===// 2 // 3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4 // See https://llvm.org/LICENSE.txt for license information. 5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6 // 7 //===----------------------------------------------------------------------===// 8 9 #ifndef LLVM_LIBC_SRC_THREADS_LINUX_FUTEX_H 10 #define LLVM_LIBC_SRC_THREADS_LINUX_FUTEX_H 11 12 #include <stdatomic.h> 13 14 namespace __llvm_libc { 15 16 // The futex data has to be exactly 4 bytes long. However, we use a uint type 17 // here as we do not want to use `_Atomic uint32_t` as the _Atomic keyword which 18 // is C only. The header stdatomic.h does not define an atomic type 19 // corresponding to `uint32_t` or to something which is exactly 4 bytes wide. 20 using FutexWord = atomic_uint; 21 static_assert(sizeof(atomic_uint) == 4, 22 "Size of the `atomic_uint` type is not 4 bytes on your platform. " 23 "The implementation of the standard threads library for linux " 24 "requires that size of `atomic_uint` be 4 bytes."); 25 26 } // namespace __llvm_libc 27 28 #endif // LLVM_LIBC_SRC_THREADS_LINUX_FUTEX_H 29