linux_futex/scope.rs
1/// A type indicating a futex is only used from the same address space (process).
2#[derive(Clone, Copy, Debug)]
3pub struct Private(());
4
5/// A type indicating a futex might be used from multiple address spaces (processes).
6#[derive(Clone, Copy, Debug)]
7pub struct Shared(());
8
9/// [`Private`] or [`Shared`].
10pub unsafe trait Scope {
11 fn futex_flag() -> i32;
12}
13
14unsafe impl Scope for Private {
15 #[inline]
16 fn futex_flag() -> i32 {
17 libc::FUTEX_PRIVATE_FLAG
18 }
19}
20
21unsafe impl Scope for Shared {
22 #[inline]
23 fn futex_flag() -> i32 {
24 0
25 }
26}