Trait miri::concurrency::sync::EvalContextExt
source · [−]pub trait EvalContextExt<'mir, 'tcx: 'mir>: MiriEvalContextExt<'mir, 'tcx> {
Show 26 methods
fn mutex_create(&mut self) -> MutexId { ... }
fn mutex_get_or_create<F>(
&mut self,
existing: F
) -> InterpResult<'tcx, MutexId>
where
F: FnOnce(&mut MiriEvalContext<'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_create(&mut self) -> RwLockId { ... }
fn rwlock_get_or_create<F>(
&mut self,
existing: F
) -> InterpResult<'tcx, RwLockId>
where
F: FnOnce(&mut MiriEvalContext<'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_create(&mut self) -> CondvarId { ... }
fn condvar_get_or_create<F>(
&mut self,
existing: F
) -> InterpResult<'tcx, CondvarId>
where
F: FnOnce(&mut MiriEvalContext<'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, mutex: MutexId) { ... }
fn condvar_signal(&mut self, id: CondvarId) -> Option<(ThreadId, MutexId)> { ... }
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
sourcefn mutex_create(&mut self) -> MutexId
fn mutex_create(&mut self) -> MutexId
Create state for a new mutex.
sourcefn mutex_get_or_create<F>(&mut self, existing: F) -> InterpResult<'tcx, MutexId>where
F: FnOnce(&mut MiriEvalContext<'mir, 'tcx>, MutexId) -> InterpResult<'tcx, Option<MutexId>>,
fn mutex_get_or_create<F>(&mut self, existing: F) -> InterpResult<'tcx, MutexId>where
F: FnOnce(&mut MiriEvalContext<'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.
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_create(&mut self) -> RwLockId
fn rwlock_create(&mut self) -> RwLockId
Create state for a new read write lock.
sourcefn rwlock_get_or_create<F>(
&mut self,
existing: F
) -> InterpResult<'tcx, RwLockId>where
F: FnOnce(&mut MiriEvalContext<'mir, 'tcx>, RwLockId) -> InterpResult<'tcx, Option<RwLockId>>,
fn rwlock_get_or_create<F>(
&mut self,
existing: F
) -> InterpResult<'tcx, RwLockId>where
F: FnOnce(&mut MiriEvalContext<'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_create(&mut self) -> CondvarId
fn condvar_create(&mut self) -> CondvarId
Create state for a new conditional variable.
sourcefn condvar_get_or_create<F>(
&mut self,
existing: F
) -> InterpResult<'tcx, CondvarId>where
F: FnOnce(&mut MiriEvalContext<'mir, 'tcx>, CondvarId) -> InterpResult<'tcx, Option<CondvarId>>,
fn condvar_get_or_create<F>(
&mut self,
existing: F
) -> InterpResult<'tcx, CondvarId>where
F: FnOnce(&mut MiriEvalContext<'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, mutex: MutexId)
fn condvar_wait(&mut self, id: CondvarId, thread: ThreadId, mutex: MutexId)
Mark that the thread is waiting on the conditional variable.
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.