diff options
author | Schrodinger ZHU Yifan <yifanzhu@rochester.edu> | 2024-05-07 10:47:41 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-07 10:47:41 -0400 |
commit | ab3a9e724d87a4272782f76b90fb0872a6a86939 (patch) | |
tree | 17d961cdd20883309392626ca2645658af815c36 /llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp | |
parent | 099417d617cf44711377d02eedc580a0c11297e9 (diff) | |
download | llvm-ab3a9e724d87a4272782f76b90fb0872a6a86939.zip llvm-ab3a9e724d87a4272782f76b90fb0872a6a86939.tar.gz llvm-ab3a9e724d87a4272782f76b90fb0872a6a86939.tar.bz2 |
[libc] clean up futex usage (#91163)
# Motivation
Futex syscalls are widely used in our codebase as synchronization
mechanism. Hence, it may be worthy to abstract out the most common
routines (wait and wake). On the other hand, C++20 also provides
`std::atomic_notify_one/std::atomic_wait/std::atomic_notify_all` which
align with such functionalities. This PR introduces `Futex` as a subtype
of `cpp::Atomic<FutexWordType>` with additional
`notify_one/notify_all/wait` operations.
Providing such wrappers also make future porting easier. For example,
FreeBSD's `_umtx_op` and Darwin's `ulock` can be wrapped in a similar
manner.
### Similar Examples
1. [bionic
futex](https://android.googlesource.com/platform/bionic/+/refs/heads/main/libc/bionic/bionic_futex.cpp)
2. [futex in Rust's
std](https://github.com/rust-lang/rust/blob/8cef37dbb67e9c80702925f19cf298c4203991e4/library/std/src/sys/pal/unix/futex.rs#L21)
Diffstat (limited to 'llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp')
0 files changed, 0 insertions, 0 deletions