pub struct FutexTable { /* private fields */ }Expand description
A kernel-wide table of futexes sharded across NUM_BUCKETS hash buckets.
Each 32-bit aligned address in an address space can potentially have an associated futex that
userspace can wait upon. Both private (FUTEX_PRIVATE_FLAG) and shared futexes share this
table via FutexKeyValue. Each bucket holds intrusive doubly-linked lists of
stack-allocated waiter nodes for internal waiters (wait, wait_boot, and lock_pi),
eliminating per-process table allocations and per-wait heap allocations.
Implementations§
Source§impl FutexTable
impl FutexTable
Sourcepub fn wait_boot<Key: FutexKey>(
&self,
current_task: &CurrentTask,
addr: UserAddress,
value: u32,
mask: u32,
deadline: BootInstant,
timer_slack: BootDuration,
) -> Result<(), Errno>
pub fn wait_boot<Key: FutexKey>( &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<Key: FutexKey>(
&self,
current_task: &CurrentTask,
addr: UserAddress,
value: u32,
mask: u32,
deadline: MonotonicInstant,
) -> Result<(), Errno>
pub fn wait<Key: FutexKey>( &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<Key: FutexKey>(
&self,
task: &Task,
addr: UserAddress,
count: usize,
mask: u32,
) -> Result<usize, Errno>
pub fn wake<Key: FutexKey>( &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<Key: FutexKey>(
&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<Key: FutexKey>( &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 get_rt_mutex_priority_boost(&self, owner_tid: u32) -> Option<i64>
pub fn get_rt_mutex_priority_boost(&self, owner_tid: u32) -> Option<i64>
Returns the highest priority (lowest numerical task_prio value) among waiters blocked on
any RT-Mutex currently owned by owner_tid, including transitive priority boosts.
Sourcepub fn lock_pi<Key: FutexKey>(
&self,
current_task: &CurrentTask,
addr: UserAddress,
deadline: MonotonicInstant,
) -> Result<(), Errno>
pub fn lock_pi<Key: FutexKey>( &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<Key: FutexKey>(
&self,
current_task: &CurrentTask,
addr: UserAddress,
) -> Result<(), Errno>
pub fn unlock_pi<Key: FutexKey>( &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 bucket.
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 !Freeze for FutexTable
impl !RefUnwindSafe for FutexTable
impl !UnwindSafe for FutexTable
impl Send for FutexTable
impl Sync for FutexTable
impl Unpin for FutexTable
impl UnsafeUnpin for FutexTable
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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