summaryrefslogtreecommitdiff
path: root/vendor/rustix/src/backend/libc/thread/futex.rs
diff options
context:
space:
mode:
authorValentin Popov <valentin@popov.link>2024-01-08 00:21:28 +0300
committerValentin Popov <valentin@popov.link>2024-01-08 00:21:28 +0300
commit1b6a04ca5504955c571d1c97504fb45ea0befee4 (patch)
tree7579f518b23313e8a9748a88ab6173d5e030b227 /vendor/rustix/src/backend/libc/thread/futex.rs
parent5ecd8cf2cba827454317368b68571df0d13d7842 (diff)
downloadfparkan-1b6a04ca5504955c571d1c97504fb45ea0befee4.tar.xz
fparkan-1b6a04ca5504955c571d1c97504fb45ea0befee4.zip
Initial vendor packages
Signed-off-by: Valentin Popov <valentin@popov.link>
Diffstat (limited to 'vendor/rustix/src/backend/libc/thread/futex.rs')
-rw-r--r--vendor/rustix/src/backend/libc/thread/futex.rs43
1 files changed, 43 insertions, 0 deletions
diff --git a/vendor/rustix/src/backend/libc/thread/futex.rs b/vendor/rustix/src/backend/libc/thread/futex.rs
new file mode 100644
index 0000000..44d96f0
--- /dev/null
+++ b/vendor/rustix/src/backend/libc/thread/futex.rs
@@ -0,0 +1,43 @@
+use crate::backend::c;
+
+bitflags::bitflags! {
+ /// `FUTEX_*` flags for use with [`futex`].
+ ///
+ /// [`futex`]: crate::thread::futex
+ #[repr(transparent)]
+ #[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)]
+ pub struct FutexFlags: u32 {
+ /// `FUTEX_PRIVATE_FLAG`
+ const PRIVATE = bitcast!(c::FUTEX_PRIVATE_FLAG);
+ /// `FUTEX_CLOCK_REALTIME`
+ const CLOCK_REALTIME = bitcast!(c::FUTEX_CLOCK_REALTIME);
+ }
+}
+
+/// `FUTEX_*` operations for use with [`futex`].
+///
+/// [`futex`]: crate::thread::futex
+#[derive(Debug, Copy, Clone, Eq, PartialEq)]
+#[repr(u32)]
+pub enum FutexOperation {
+ /// `FUTEX_WAIT`
+ Wait = bitcast!(c::FUTEX_WAIT),
+ /// `FUTEX_WAKE`
+ Wake = bitcast!(c::FUTEX_WAKE),
+ /// `FUTEX_FD`
+ Fd = bitcast!(c::FUTEX_FD),
+ /// `FUTEX_REQUEUE`
+ Requeue = bitcast!(c::FUTEX_REQUEUE),
+ /// `FUTEX_CMP_REQUEUE`
+ CmpRequeue = bitcast!(c::FUTEX_CMP_REQUEUE),
+ /// `FUTEX_WAKE_OP`
+ WakeOp = bitcast!(c::FUTEX_WAKE_OP),
+ /// `FUTEX_LOCK_PI`
+ LockPi = bitcast!(c::FUTEX_LOCK_PI),
+ /// `FUTEX_UNLOCK_PI`
+ UnlockPi = bitcast!(c::FUTEX_UNLOCK_PI),
+ /// `FUTEX_TRYLOCK_PI`
+ TrylockPi = bitcast!(c::FUTEX_TRYLOCK_PI),
+ /// `FUTEX_WAIT_BITSET`
+ WaitBitset = bitcast!(c::FUTEX_WAIT_BITSET),
+}