Trait miri::concurrency::thread::EvalContextExt
source · pub trait EvalContextExt<'tcx>: MiriInterpCxExt<'tcx> {
Show 21 methods
// Provided methods
fn get_or_create_thread_local_alloc(
&mut self,
def_id: DefId,
) -> InterpResult<'tcx, StrictPointer> { ... }
fn start_regular_thread(
&mut self,
thread: Option<MPlaceTy<'tcx>>,
start_routine: Pointer,
start_abi: Abi,
func_arg: ImmTy<'tcx>,
ret_layout: TyAndLayout<'tcx>,
) -> InterpResult<'tcx, ThreadId> { ... }
fn terminate_active_thread(
&mut self,
tls_alloc_action: TlsAllocAction,
) -> InterpResult<'tcx> { ... }
fn block_thread(
&mut self,
reason: BlockReason,
timeout: Option<(TimeoutClock, TimeoutAnchor, Duration)>,
callback: impl UnblockCallback<'tcx> + 'tcx,
) { ... }
fn unblock_thread(
&mut self,
thread: ThreadId,
reason: BlockReason,
) -> InterpResult<'tcx> { ... }
fn detach_thread(
&mut self,
thread_id: ThreadId,
allow_terminated_joined: bool,
) -> InterpResult<'tcx> { ... }
fn join_thread(&mut self, joined_thread_id: ThreadId) -> InterpResult<'tcx> { ... }
fn join_thread_exclusive(
&mut self,
joined_thread_id: ThreadId,
) -> InterpResult<'tcx> { ... }
fn active_thread(&self) -> ThreadId { ... }
fn active_thread_mut(&mut self) -> &mut Thread<'tcx> { ... }
fn active_thread_ref(&self) -> &Thread<'tcx> { ... }
fn get_total_thread_count(&self) -> usize { ... }
fn have_all_terminated(&self) -> bool { ... }
fn enable_thread(&mut self, thread_id: ThreadId) { ... }
fn active_thread_stack<'a>(
&'a self,
) -> &'a [Frame<'tcx, Provenance, FrameExtra<'tcx>>] { ... }
fn active_thread_stack_mut<'a>(
&'a mut self,
) -> &'a mut Vec<Frame<'tcx, Provenance, FrameExtra<'tcx>>> { ... }
fn set_thread_name(&mut self, thread: ThreadId, new_thread_name: Vec<u8>) { ... }
fn get_thread_name<'c>(&'c self, thread: ThreadId) -> Option<&'c [u8]>
where 'tcx: 'c { ... }
fn yield_active_thread(&mut self) { ... }
fn maybe_preempt_active_thread(&mut self) { ... }
fn run_threads(&mut self) -> InterpResult<'tcx, !> { ... }
}
Provided Methods§
sourcefn get_or_create_thread_local_alloc(
&mut self,
def_id: DefId,
) -> InterpResult<'tcx, StrictPointer>
fn get_or_create_thread_local_alloc( &mut self, def_id: DefId, ) -> InterpResult<'tcx, StrictPointer>
Get a thread-specific allocation id for the given thread-local static. If needed, allocate a new one.
sourcefn start_regular_thread(
&mut self,
thread: Option<MPlaceTy<'tcx>>,
start_routine: Pointer,
start_abi: Abi,
func_arg: ImmTy<'tcx>,
ret_layout: TyAndLayout<'tcx>,
) -> InterpResult<'tcx, ThreadId>
fn start_regular_thread( &mut self, thread: Option<MPlaceTy<'tcx>>, start_routine: Pointer, start_abi: Abi, func_arg: ImmTy<'tcx>, ret_layout: TyAndLayout<'tcx>, ) -> InterpResult<'tcx, ThreadId>
Start a regular (non-main) thread.
sourcefn terminate_active_thread(
&mut self,
tls_alloc_action: TlsAllocAction,
) -> InterpResult<'tcx>
fn terminate_active_thread( &mut self, tls_alloc_action: TlsAllocAction, ) -> InterpResult<'tcx>
Handles thread termination of the active thread: wakes up threads joining on this one,
and deals with the thread’s thread-local statics according to tls_alloc_action
.
This is called by the eval loop when a thread’s on_stack_empty returns Ready
.
sourcefn block_thread(
&mut self,
reason: BlockReason,
timeout: Option<(TimeoutClock, TimeoutAnchor, Duration)>,
callback: impl UnblockCallback<'tcx> + 'tcx,
)
fn block_thread( &mut self, reason: BlockReason, timeout: Option<(TimeoutClock, TimeoutAnchor, Duration)>, callback: impl UnblockCallback<'tcx> + 'tcx, )
Block the current thread, with an optional timeout. The callback will be invoked when the thread gets unblocked.
sourcefn unblock_thread(
&mut self,
thread: ThreadId,
reason: BlockReason,
) -> InterpResult<'tcx>
fn unblock_thread( &mut self, thread: ThreadId, reason: BlockReason, ) -> InterpResult<'tcx>
Put the blocked thread into the enabled state. Sanity-checks that the thread previously was blocked for the right reason.
fn detach_thread( &mut self, thread_id: ThreadId, allow_terminated_joined: bool, ) -> InterpResult<'tcx>
fn join_thread(&mut self, joined_thread_id: ThreadId) -> InterpResult<'tcx>
fn join_thread_exclusive( &mut self, joined_thread_id: ThreadId, ) -> InterpResult<'tcx>
fn active_thread(&self) -> ThreadId
fn active_thread_mut(&mut self) -> &mut Thread<'tcx>
fn active_thread_ref(&self) -> &Thread<'tcx>
fn get_total_thread_count(&self) -> usize
fn have_all_terminated(&self) -> bool
fn enable_thread(&mut self, thread_id: ThreadId)
fn active_thread_stack<'a>( &'a self, ) -> &'a [Frame<'tcx, Provenance, FrameExtra<'tcx>>]
fn active_thread_stack_mut<'a>( &'a mut self, ) -> &'a mut Vec<Frame<'tcx, Provenance, FrameExtra<'tcx>>>
sourcefn set_thread_name(&mut self, thread: ThreadId, new_thread_name: Vec<u8>)
fn set_thread_name(&mut self, thread: ThreadId, new_thread_name: Vec<u8>)
Set the name of the current thread. The buffer must not include the null terminator.
fn get_thread_name<'c>(&'c self, thread: ThreadId) -> Option<&'c [u8]>where
'tcx: 'c,
fn yield_active_thread(&mut self)
fn maybe_preempt_active_thread(&mut self)
sourcefn run_threads(&mut self) -> InterpResult<'tcx, !>
fn run_threads(&mut self) -> InterpResult<'tcx, !>
Run the core interpreter loop. Returns only when an interrupt occurs (an error or program termination).