Trait miri::concurrency::sync::EvalContextExt

source ·
pub trait EvalContextExt<'tcx>: MiriInterpCxExt<'tcx> {
Show 21 methods // Provided methods fn mutex_get_or_create_id( &mut self, lock_op: &OpTy<'tcx>, lock_layout: TyAndLayout<'tcx>, offset: u64, ) -> InterpResult<'tcx, MutexId> { ... } fn rwlock_get_or_create_id( &mut self, lock_op: &OpTy<'tcx>, lock_layout: TyAndLayout<'tcx>, offset: u64, ) -> InterpResult<'tcx, RwLockId> { ... } fn condvar_get_or_create_id( &mut self, lock_op: &OpTy<'tcx>, lock_layout: TyAndLayout<'tcx>, offset: u64, ) -> InterpResult<'tcx, CondvarId> { ... } fn mutex_get_owner(&mut self, id: MutexId) -> ThreadId { ... } fn mutex_is_locked(&self, id: MutexId) -> bool { ... } fn mutex_lock(&mut self, id: MutexId) { ... } fn mutex_unlock(&mut self, id: MutexId) -> InterpResult<'tcx, Option<usize>> { ... } fn mutex_enqueue_and_block( &mut self, id: MutexId, retval_dest: Option<(Scalar, MPlaceTy<'tcx>)>, ) { ... } fn rwlock_is_locked(&self, id: RwLockId) -> bool { ... } fn rwlock_is_write_locked(&self, id: RwLockId) -> bool { ... } fn rwlock_reader_lock(&mut self, id: RwLockId) { ... } fn rwlock_reader_unlock(&mut self, id: RwLockId) -> InterpResult<'tcx, bool> { ... } fn rwlock_enqueue_and_block_reader( &mut self, id: RwLockId, retval: Scalar, dest: MPlaceTy<'tcx>, ) { ... } fn rwlock_writer_lock(&mut self, id: RwLockId) { ... } fn rwlock_writer_unlock(&mut self, id: RwLockId) -> InterpResult<'tcx, bool> { ... } fn rwlock_enqueue_and_block_writer( &mut self, id: RwLockId, retval: Scalar, dest: MPlaceTy<'tcx>, ) { ... } fn condvar_is_awaited(&mut self, id: CondvarId) -> bool { ... } fn condvar_wait( &mut self, condvar: CondvarId, mutex: MutexId, timeout: Option<(TimeoutClock, TimeoutAnchor, Duration)>, retval_succ: Scalar, retval_timeout: Scalar, dest: MPlaceTy<'tcx>, ) -> InterpResult<'tcx> { ... } fn condvar_signal(&mut self, id: CondvarId) -> InterpResult<'tcx, bool> { ... } fn futex_wait( &mut self, addr: u64, bitset: u32, timeout: Option<(TimeoutClock, TimeoutAnchor, Duration)>, retval_succ: Scalar, retval_timeout: Scalar, dest: MPlaceTy<'tcx>, errno_timeout: Scalar, ) { ... } fn futex_wake(&mut self, addr: u64, bitset: u32) -> InterpResult<'tcx, bool> { ... }
}

Provided Methods§

source

fn mutex_get_or_create_id( &mut self, lock_op: &OpTy<'tcx>, lock_layout: TyAndLayout<'tcx>, offset: u64, ) -> InterpResult<'tcx, MutexId>

source

fn rwlock_get_or_create_id( &mut self, lock_op: &OpTy<'tcx>, lock_layout: TyAndLayout<'tcx>, offset: u64, ) -> InterpResult<'tcx, RwLockId>

source

fn condvar_get_or_create_id( &mut self, lock_op: &OpTy<'tcx>, lock_layout: TyAndLayout<'tcx>, offset: u64, ) -> InterpResult<'tcx, CondvarId>

source

fn mutex_get_owner(&mut self, id: MutexId) -> ThreadId

Get the id of the thread that currently owns this lock.

source

fn mutex_is_locked(&self, id: MutexId) -> bool

Check if locked.

source

fn mutex_lock(&mut self, id: MutexId)

Lock by setting the mutex owner and increasing the lock count.

source

fn mutex_unlock(&mut self, id: MutexId) -> InterpResult<'tcx, Option<usize>>

Try unlocking by decreasing the lock count and returning the old lock count. If the lock count reaches 0, release the lock and potentially give to a new owner. If the lock was not locked by the current thread, return None.

source

fn mutex_enqueue_and_block( &mut self, id: MutexId, retval_dest: Option<(Scalar, MPlaceTy<'tcx>)>, )

Put the thread into the queue waiting for the mutex.

Once the Mutex becomes available and if it exists, retval_dest.0 will be written to retval_dest.1.

source

fn rwlock_is_locked(&self, id: RwLockId) -> bool

Check if locked.

source

fn rwlock_is_write_locked(&self, id: RwLockId) -> bool

Check if write locked.

source

fn rwlock_reader_lock(&mut self, id: RwLockId)

Read-lock the lock by adding the reader the list of threads that own this lock.

source

fn rwlock_reader_unlock(&mut self, id: RwLockId) -> InterpResult<'tcx, bool>

Try read-unlock the lock for the current threads and potentially give the lock to a new owner. Returns true if succeeded, false if this reader did not hold the lock.

source

fn rwlock_enqueue_and_block_reader( &mut self, id: RwLockId, retval: Scalar, dest: MPlaceTy<'tcx>, )

Put the reader in the queue waiting for the lock and block it. Once the lock becomes available, retval will be written to dest.

source

fn rwlock_writer_lock(&mut self, id: RwLockId)

Lock by setting the writer that owns the lock.

source

fn rwlock_writer_unlock(&mut self, id: RwLockId) -> InterpResult<'tcx, bool>

Try to unlock an rwlock held by the current thread. Return false if it is held by another thread.

source

fn rwlock_enqueue_and_block_writer( &mut self, id: RwLockId, retval: Scalar, dest: MPlaceTy<'tcx>, )

Put the writer in the queue waiting for the lock. Once the lock becomes available, retval will be written to dest.

source

fn condvar_is_awaited(&mut self, id: CondvarId) -> bool

Is the conditional variable awaited?

source

fn condvar_wait( &mut self, condvar: CondvarId, mutex: MutexId, timeout: Option<(TimeoutClock, TimeoutAnchor, Duration)>, retval_succ: Scalar, retval_timeout: Scalar, dest: MPlaceTy<'tcx>, ) -> InterpResult<'tcx>

Release the mutex and let the current thread wait on the given condition variable. Once it is signaled, the mutex will be acquired and retval_succ will be written to dest. If the timeout happens first, retval_timeout will be written to dest.

source

fn condvar_signal(&mut self, id: CondvarId) -> InterpResult<'tcx, bool>

Wake up some thread (if there is any) sleeping on the conditional variable. Returns true iff any thread was woken up.

source

fn futex_wait( &mut self, addr: u64, bitset: u32, timeout: Option<(TimeoutClock, TimeoutAnchor, Duration)>, retval_succ: Scalar, retval_timeout: Scalar, dest: MPlaceTy<'tcx>, errno_timeout: Scalar, )

Wait for the futex to be signaled, or a timeout. On a signal, retval_succ is written to dest. On a timeout, retval_timeout is written to dest and errno_timeout is set as the last error.

source

fn futex_wake(&mut self, addr: u64, bitset: u32) -> InterpResult<'tcx, bool>

Returns whether anything was woken.

Implementors§

source§

impl<'tcx> EvalContextExt<'tcx> for MiriInterpCx<'tcx>