Trait miri::concurrency::sync::EvalContextExt
source · pub trait EvalContextExt<'mir, 'tcx: 'mir>: MiriInterpCxExt<'mir, 'tcx> {
Show 26 methods
// Provided methods
fn mutex_get_or_create_id(
&mut self,
lock_op: &OpTy<'tcx, Provenance>,
lock_layout: TyAndLayout<'tcx>,
offset: u64
) -> InterpResult<'tcx, MutexId> { ... }
fn rwlock_get_or_create_id(
&mut self,
lock_op: &OpTy<'tcx, Provenance>,
lock_layout: TyAndLayout<'tcx>,
offset: u64
) -> InterpResult<'tcx, RwLockId> { ... }
fn condvar_get_or_create_id(
&mut self,
lock_op: &OpTy<'tcx, Provenance>,
lock_layout: TyAndLayout<'tcx>,
offset: u64
) -> InterpResult<'tcx, CondvarId> { ... }
fn mutex_get_or_create<F>(
&mut self,
existing: F
) -> InterpResult<'tcx, MutexId>
where F: FnOnce(&mut MiriInterpCx<'mir, 'tcx>, MutexId) -> InterpResult<'tcx, Option<MutexId>> { ... }
fn mutex_get_owner(&mut self, id: MutexId) -> ThreadId { ... }
fn mutex_is_locked(&self, id: MutexId) -> bool { ... }
fn mutex_lock(&mut self, id: MutexId, thread: ThreadId) { ... }
fn mutex_unlock(
&mut self,
id: MutexId,
expected_owner: ThreadId
) -> Option<usize> { ... }
fn mutex_enqueue_and_block(&mut self, id: MutexId, thread: ThreadId) { ... }
fn rwlock_get_or_create<F>(
&mut self,
existing: F
) -> InterpResult<'tcx, RwLockId>
where F: FnOnce(&mut MiriInterpCx<'mir, 'tcx>, RwLockId) -> InterpResult<'tcx, Option<RwLockId>> { ... }
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, reader: ThreadId) { ... }
fn rwlock_reader_unlock(&mut self, id: RwLockId, reader: ThreadId) -> bool { ... }
fn rwlock_enqueue_and_block_reader(
&mut self,
id: RwLockId,
reader: ThreadId
) { ... }
fn rwlock_writer_lock(&mut self, id: RwLockId, writer: ThreadId) { ... }
fn rwlock_writer_unlock(
&mut self,
id: RwLockId,
expected_writer: ThreadId
) -> bool { ... }
fn rwlock_enqueue_and_block_writer(
&mut self,
id: RwLockId,
writer: ThreadId
) { ... }
fn condvar_get_or_create<F>(
&mut self,
existing: F
) -> InterpResult<'tcx, CondvarId>
where F: FnOnce(&mut MiriInterpCx<'mir, 'tcx>, CondvarId) -> InterpResult<'tcx, Option<CondvarId>> { ... }
fn condvar_is_awaited(&mut self, id: CondvarId) -> bool { ... }
fn condvar_wait(
&mut self,
id: CondvarId,
thread: ThreadId,
lock: CondvarLock
) { ... }
fn condvar_signal(
&mut self,
id: CondvarId
) -> Option<(ThreadId, CondvarLock)> { ... }
fn condvar_remove_waiter(&mut self, id: CondvarId, thread: ThreadId) { ... }
fn futex_wait(&mut self, addr: u64, thread: ThreadId, bitset: u32) { ... }
fn futex_wake(&mut self, addr: u64, bitset: u32) -> Option<ThreadId> { ... }
fn futex_remove_waiter(&mut self, addr: u64, thread: ThreadId) { ... }
}
Provided Methods§
fn mutex_get_or_create_id( &mut self, lock_op: &OpTy<'tcx, Provenance>, lock_layout: TyAndLayout<'tcx>, offset: u64 ) -> InterpResult<'tcx, MutexId>
fn rwlock_get_or_create_id( &mut self, lock_op: &OpTy<'tcx, Provenance>, lock_layout: TyAndLayout<'tcx>, offset: u64 ) -> InterpResult<'tcx, RwLockId>
fn condvar_get_or_create_id( &mut self, lock_op: &OpTy<'tcx, Provenance>, lock_layout: TyAndLayout<'tcx>, offset: u64 ) -> InterpResult<'tcx, CondvarId>
sourcefn mutex_get_or_create<F>(&mut self, existing: F) -> InterpResult<'tcx, MutexId>where
F: FnOnce(&mut MiriInterpCx<'mir, 'tcx>, MutexId) -> InterpResult<'tcx, Option<MutexId>>,
fn mutex_get_or_create<F>(&mut self, existing: F) -> InterpResult<'tcx, MutexId>where F: FnOnce(&mut MiriInterpCx<'mir, 'tcx>, MutexId) -> InterpResult<'tcx, Option<MutexId>>,
Provides the closure with the next MutexId. Creates that mutex if the closure returns None, otherwise returns the value from the closure
sourcefn mutex_get_owner(&mut self, id: MutexId) -> ThreadId
fn mutex_get_owner(&mut self, id: MutexId) -> ThreadId
Get the id of the thread that currently owns this lock.
sourcefn mutex_is_locked(&self, id: MutexId) -> bool
fn mutex_is_locked(&self, id: MutexId) -> bool
Check if locked.
sourcefn mutex_lock(&mut self, id: MutexId, thread: ThreadId)
fn mutex_lock(&mut self, id: MutexId, thread: ThreadId)
Lock by setting the mutex owner and increasing the lock count.
sourcefn mutex_unlock(
&mut self,
id: MutexId,
expected_owner: ThreadId
) -> Option<usize>
fn mutex_unlock( &mut self, id: MutexId, expected_owner: ThreadId ) -> 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 expected_owner
,
return None
.
sourcefn mutex_enqueue_and_block(&mut self, id: MutexId, thread: ThreadId)
fn mutex_enqueue_and_block(&mut self, id: MutexId, thread: ThreadId)
Put the thread into the queue waiting for the mutex.
sourcefn rwlock_get_or_create<F>(
&mut self,
existing: F
) -> InterpResult<'tcx, RwLockId>where
F: FnOnce(&mut MiriInterpCx<'mir, 'tcx>, RwLockId) -> InterpResult<'tcx, Option<RwLockId>>,
fn rwlock_get_or_create<F>( &mut self, existing: F ) -> InterpResult<'tcx, RwLockId>where F: FnOnce(&mut MiriInterpCx<'mir, 'tcx>, RwLockId) -> InterpResult<'tcx, Option<RwLockId>>,
Provides the closure with the next RwLockId. Creates that RwLock if the closure returns None, otherwise returns the value from the closure
sourcefn rwlock_is_locked(&self, id: RwLockId) -> bool
fn rwlock_is_locked(&self, id: RwLockId) -> bool
Check if locked.
sourcefn rwlock_is_write_locked(&self, id: RwLockId) -> bool
fn rwlock_is_write_locked(&self, id: RwLockId) -> bool
Check if write locked.
sourcefn rwlock_reader_lock(&mut self, id: RwLockId, reader: ThreadId)
fn rwlock_reader_lock(&mut self, id: RwLockId, reader: ThreadId)
Read-lock the lock by adding the reader
the list of threads that own
this lock.
sourcefn rwlock_reader_unlock(&mut self, id: RwLockId, reader: ThreadId) -> bool
fn rwlock_reader_unlock(&mut self, id: RwLockId, reader: ThreadId) -> bool
Try read-unlock the lock for reader
and potentially give the lock to a new owner.
Returns true
if succeeded, false
if this reader
did not hold the lock.
sourcefn rwlock_enqueue_and_block_reader(&mut self, id: RwLockId, reader: ThreadId)
fn rwlock_enqueue_and_block_reader(&mut self, id: RwLockId, reader: ThreadId)
Put the reader in the queue waiting for the lock and block it.
sourcefn rwlock_writer_lock(&mut self, id: RwLockId, writer: ThreadId)
fn rwlock_writer_lock(&mut self, id: RwLockId, writer: ThreadId)
Lock by setting the writer that owns the lock.
sourcefn rwlock_writer_unlock(
&mut self,
id: RwLockId,
expected_writer: ThreadId
) -> bool
fn rwlock_writer_unlock( &mut self, id: RwLockId, expected_writer: ThreadId ) -> bool
Try to unlock by removing the writer.
sourcefn rwlock_enqueue_and_block_writer(&mut self, id: RwLockId, writer: ThreadId)
fn rwlock_enqueue_and_block_writer(&mut self, id: RwLockId, writer: ThreadId)
Put the writer in the queue waiting for the lock.
sourcefn condvar_get_or_create<F>(
&mut self,
existing: F
) -> InterpResult<'tcx, CondvarId>where
F: FnOnce(&mut MiriInterpCx<'mir, 'tcx>, CondvarId) -> InterpResult<'tcx, Option<CondvarId>>,
fn condvar_get_or_create<F>( &mut self, existing: F ) -> InterpResult<'tcx, CondvarId>where F: FnOnce(&mut MiriInterpCx<'mir, 'tcx>, CondvarId) -> InterpResult<'tcx, Option<CondvarId>>,
Provides the closure with the next CondvarId. Creates that Condvar if the closure returns None, otherwise returns the value from the closure
sourcefn condvar_is_awaited(&mut self, id: CondvarId) -> bool
fn condvar_is_awaited(&mut self, id: CondvarId) -> bool
Is the conditional variable awaited?
sourcefn condvar_wait(&mut self, id: CondvarId, thread: ThreadId, lock: CondvarLock)
fn condvar_wait(&mut self, id: CondvarId, thread: ThreadId, lock: CondvarLock)
Mark that the thread is waiting on the conditional variable.
sourcefn condvar_signal(&mut self, id: CondvarId) -> Option<(ThreadId, CondvarLock)>
fn condvar_signal(&mut self, id: CondvarId) -> Option<(ThreadId, CondvarLock)>
Wake up some thread (if there is any) sleeping on the conditional variable.
sourcefn condvar_remove_waiter(&mut self, id: CondvarId, thread: ThreadId)
fn condvar_remove_waiter(&mut self, id: CondvarId, thread: ThreadId)
Remove the thread from the queue of threads waiting on this conditional variable.