1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
/// A type indicating a futex is only used from the same address space (process).
#[derive(Clone, Copy, Debug)]
pub struct Private(());

/// A type indicating a futex might be used from multiple address spaces (processes).
#[derive(Clone, Copy, Debug)]
pub struct Shared(());

/// [`Private`] or [`Shared`].
pub unsafe trait Scope {
	fn futex_flag() -> i32;
}

unsafe impl Scope for Private {
	#[inline]
	fn futex_flag() -> i32 {
		libc::FUTEX_PRIVATE_FLAG
	}
}

unsafe impl Scope for Shared {
	#[inline]
	fn futex_flag() -> i32 {
		0
	}
}