pub struct FutexTable<Key: FutexKey> { /* private fields */ }Expand description
A table of futexes.
Each 32-bit aligned address in an address space can potentially have an associated futex that userspace can wait upon. This table is a sparse representation that has an actual WaitQueue only for those addresses that have ever actually had a futex operation performed on them.
Implementations§
Source§impl<Key: FutexKey> FutexTable<Key>
impl<Key: FutexKey> FutexTable<Key>
Sourcepub fn wait_boot(
&self,
locked: &mut Locked<Unlocked>,
current_task: &CurrentTask,
addr: UserAddress,
value: u32,
mask: u32,
deadline: BootInstant,
timer_slack: BootDuration,
) -> Result<(), Errno>
pub fn wait_boot( &self, locked: &mut Locked<Unlocked>, current_task: &CurrentTask, addr: UserAddress, value: u32, mask: u32, deadline: BootInstant, timer_slack: BootDuration, ) -> Result<(), Errno>
Wait on the futex at the given address given a boot deadline.
See FUTEX_WAIT when passed a deadline in CLOCK_REALTIME.
Sourcepub fn wait<L>(
&self,
locked: &mut Locked<L>,
current_task: &CurrentTask,
addr: UserAddress,
value: u32,
mask: u32,
deadline: MonotonicInstant,
) -> Result<(), Errno>where
L: LockBefore<TerminalLock>,
pub fn wait<L>(
&self,
locked: &mut Locked<L>,
current_task: &CurrentTask,
addr: UserAddress,
value: u32,
mask: u32,
deadline: MonotonicInstant,
) -> Result<(), Errno>where
L: LockBefore<TerminalLock>,
Wait on the futex at the given address.
See FUTEX_WAIT.
Sourcepub fn wake<L>(
&self,
locked: &mut Locked<L>,
task: &Task,
addr: UserAddress,
count: usize,
mask: u32,
) -> Result<usize, Errno>where
L: LockBefore<TerminalLock>,
pub fn wake<L>(
&self,
locked: &mut Locked<L>,
task: &Task,
addr: UserAddress,
count: usize,
mask: u32,
) -> Result<usize, Errno>where
L: LockBefore<TerminalLock>,
Wake the given number of waiters on futex at the given address. Returns the number of waiters actually woken.
See FUTEX_WAKE.
Sourcepub fn requeue<L>(
&self,
locked: &mut Locked<L>,
current_task: &CurrentTask,
addr: UserAddress,
wake_count: usize,
requeue_count: usize,
new_addr: UserAddress,
expected_value: Option<u32>,
) -> Result<usize, Errno>where
L: LockBefore<TerminalLock>,
pub fn requeue<L>(
&self,
locked: &mut Locked<L>,
current_task: &CurrentTask,
addr: UserAddress,
wake_count: usize,
requeue_count: usize,
new_addr: UserAddress,
expected_value: Option<u32>,
) -> Result<usize, Errno>where
L: LockBefore<TerminalLock>,
Requeue the waiters to another address.
See FUTEX_CMP_REQUEUE
Sourcepub fn lock_pi<L>(
&self,
locked: &mut Locked<L>,
current_task: &CurrentTask,
addr: UserAddress,
deadline: MonotonicInstant,
) -> Result<(), Errno>where
L: LockBefore<TerminalLock>,
pub fn lock_pi<L>(
&self,
locked: &mut Locked<L>,
current_task: &CurrentTask,
addr: UserAddress,
deadline: MonotonicInstant,
) -> Result<(), Errno>where
L: LockBefore<TerminalLock>,
Lock the futex at the given address.
See FUTEX_LOCK_PI.
Sourcepub fn unlock_pi<L>(
&self,
locked: &mut Locked<L>,
current_task: &CurrentTask,
addr: UserAddress,
) -> Result<(), Errno>where
L: LockBefore<TerminalLock>,
pub fn unlock_pi<L>(
&self,
locked: &mut Locked<L>,
current_task: &CurrentTask,
addr: UserAddress,
) -> Result<(), Errno>where
L: LockBefore<TerminalLock>,
Unlock the futex at the given address.
See FUTEX_UNLOCK_PI.
Sourcepub fn external_wait<L>(
&self,
locked: &mut Locked<L>,
memory: MemoryObject,
offset: u64,
value: u32,
mask: u32,
) -> Result<(Arc<()>, Receiver<()>), Errno>where
L: LockBefore<TerminalLock>,
pub fn external_wait<L>(
&self,
locked: &mut Locked<L>,
memory: MemoryObject,
offset: u64,
value: u32,
mask: u32,
) -> Result<(Arc<()>, Receiver<()>), Errno>where
L: LockBefore<TerminalLock>,
Wait on the futex at the given offset in the memory.
Returns a receiver that will be signaled when the futex is woken, and an
Arc<()> token that must be kept alive by the caller for the duration of the
wait. If the caller drops the token (e.g., if the external client
disconnects), the waiter is marked as stale and will be garbage-collected by the
next futex operation on this table.
See FUTEX_WAIT.
Sourcepub fn external_wake<L>(
&self,
locked: &mut Locked<L>,
memory: MemoryObject,
offset: u64,
count: usize,
mask: u32,
) -> Result<usize, Errno>where
L: LockBefore<TerminalLock>,
pub fn external_wake<L>(
&self,
locked: &mut Locked<L>,
memory: MemoryObject,
offset: u64,
count: usize,
mask: u32,
) -> Result<usize, Errno>where
L: LockBefore<TerminalLock>,
Wake the given number of waiters on futex at the given offset in the memory. Returns the number of waiters actually woken.
See FUTEX_WAKE.
Trait Implementations§
Auto Trait Implementations§
impl<Key> !Freeze for FutexTable<Key>
impl<Key> !RefUnwindSafe for FutexTable<Key>
impl<Key> Send for FutexTable<Key>where
Key: Send,
impl<Key> Sync for FutexTable<Key>where
Key: Send,
impl<Key> Unpin for FutexTable<Key>where
Key: Unpin,
impl<Key> UnsafeUnpin for FutexTable<Key>
impl<Key> !UnwindSafe for FutexTable<Key>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T, D> Encode<Ambiguous1, D> for Twhere
D: ResourceDialect,
impl<T, D> Encode<Ambiguous1, D> for Twhere
D: ResourceDialect,
Source§impl<T, D> Encode<Ambiguous2, D> for Twhere
D: ResourceDialect,
impl<T, D> Encode<Ambiguous2, D> for Twhere
D: ResourceDialect,
§impl<T> InstanceFromServiceTransport<T> for T
impl<T> InstanceFromServiceTransport<T> for T
§fn from_service_transport(handle: T) -> T
fn from_service_transport(handle: T) -> T
T to [Self]Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more