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,
current_task: &CurrentTask,
addr: UserAddress,
value: u32,
mask: u32,
deadline: BootInstant,
timer_slack: BootDuration,
) -> Result<(), Errno>
pub fn wait_boot( &self, 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(
&self,
current_task: &CurrentTask,
addr: UserAddress,
value: u32,
mask: u32,
deadline: MonotonicInstant,
) -> Result<(), Errno>
pub fn wait( &self, current_task: &CurrentTask, addr: UserAddress, value: u32, mask: u32, deadline: MonotonicInstant, ) -> Result<(), Errno>
Wait on the futex at the given address.
See FUTEX_WAIT.
Sourcepub fn wake(
&self,
task: &Task,
addr: UserAddress,
count: usize,
mask: u32,
) -> Result<usize, Errno>
pub fn wake( &self, task: &Task, addr: UserAddress, count: usize, mask: u32, ) -> Result<usize, Errno>
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(
&self,
current_task: &CurrentTask,
addr: UserAddress,
wake_count: usize,
requeue_count: usize,
new_addr: UserAddress,
expected_value: Option<u32>,
) -> Result<usize, Errno>
pub fn requeue( &self, current_task: &CurrentTask, addr: UserAddress, wake_count: usize, requeue_count: usize, new_addr: UserAddress, expected_value: Option<u32>, ) -> Result<usize, Errno>
Requeue the waiters to another address.
See FUTEX_CMP_REQUEUE
Sourcepub fn lock_pi(
&self,
current_task: &CurrentTask,
addr: UserAddress,
deadline: MonotonicInstant,
) -> Result<(), Errno>
pub fn lock_pi( &self, current_task: &CurrentTask, addr: UserAddress, deadline: MonotonicInstant, ) -> Result<(), Errno>
Lock the futex at the given address.
See FUTEX_LOCK_PI.
Sourcepub fn unlock_pi(
&self,
current_task: &CurrentTask,
addr: UserAddress,
) -> Result<(), Errno>
pub fn unlock_pi( &self, current_task: &CurrentTask, addr: UserAddress, ) -> Result<(), Errno>
Unlock the futex at the given address.
See FUTEX_UNLOCK_PI.
Sourcepub fn external_wait(
&self,
memory: MemoryObject,
offset: u64,
value: u32,
mask: u32,
) -> Result<(Arc<()>, Receiver<()>), Errno>
pub fn external_wait( &self, memory: MemoryObject, offset: u64, value: u32, mask: u32, ) -> Result<(Arc<()>, Receiver<()>), Errno>
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(
&self,
memory: MemoryObject,
offset: u64,
count: usize,
mask: u32,
) -> Result<usize, Errno>
pub fn external_wake( &self, memory: MemoryObject, offset: u64, count: usize, mask: u32, ) -> Result<usize, Errno>
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.
pub fn external_requeue( &self, first_memory: MemoryObject, first_offset: u64, second_memory: Option<MemoryObject>, second_offset: u64, wake_count: usize, requeue_count: usize, expected_value: Option<u32>, ) -> Result<usize, Errno>
Trait Implementations§
Auto Trait Implementations§
impl<Key> !Freeze for FutexTable<Key>
impl<Key> !RefUnwindSafe for FutexTable<Key>
impl<Key> !UnwindSafe 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>
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<F, N> FidlIntoNative<Box<N>> for Fwhere
F: FidlIntoNative<N>,
impl<F, N> FidlIntoNative<Box<N>> for Fwhere
F: FidlIntoNative<N>,
fn fidl_into_native(self) -> Box<N>
§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