miri::concurrency::thread

Trait EvalContextExt

Source
pub trait EvalContextExt<'tcx>: MiriInterpCxExt<'tcx> {
Show 22 methods // Provided methods fn thread_id_try_from( &self, id: impl TryInto<u32>, ) -> Result<ThreadId, ThreadNotFound> { ... } 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: ExternAbi, 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: Box<dyn 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§

Source

fn thread_id_try_from( &self, id: impl TryInto<u32>, ) -> Result<ThreadId, ThreadNotFound>

Source

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.

Source

fn start_regular_thread( &mut self, thread: Option<MPlaceTy<'tcx>>, start_routine: Pointer, start_abi: ExternAbi, func_arg: ImmTy<'tcx>, ret_layout: TyAndLayout<'tcx>, ) -> InterpResult<'tcx, ThreadId>

Start a regular (non-main) thread.

Source

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.

Source

fn block_thread( &mut self, reason: BlockReason, timeout: Option<(TimeoutClock, TimeoutAnchor, Duration)>, callback: Box<dyn UnblockCallback<'tcx> + 'tcx>, )

Block the current thread, with an optional timeout. The callback will be invoked when the thread gets unblocked.

Source

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.

Source

fn detach_thread( &mut self, thread_id: ThreadId, allow_terminated_joined: bool, ) -> InterpResult<'tcx>

Source

fn join_thread(&mut self, joined_thread_id: ThreadId) -> InterpResult<'tcx>

Source

fn join_thread_exclusive( &mut self, joined_thread_id: ThreadId, ) -> InterpResult<'tcx>

Source

fn active_thread(&self) -> ThreadId

Source

fn active_thread_mut(&mut self) -> &mut Thread<'tcx>

Source

fn active_thread_ref(&self) -> &Thread<'tcx>

Source

fn get_total_thread_count(&self) -> usize

Source

fn have_all_terminated(&self) -> bool

Source

fn enable_thread(&mut self, thread_id: ThreadId)

Source

fn active_thread_stack<'a>( &'a self, ) -> &'a [Frame<'tcx, Provenance, FrameExtra<'tcx>>]

Source

fn active_thread_stack_mut<'a>( &'a mut self, ) -> &'a mut Vec<Frame<'tcx, Provenance, FrameExtra<'tcx>>>

Source

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.

Source

fn get_thread_name<'c>(&'c self, thread: ThreadId) -> Option<&'c [u8]>
where 'tcx: 'c,

Source

fn yield_active_thread(&mut self)

Source

fn maybe_preempt_active_thread(&mut self)

Source

fn run_threads(&mut self) -> InterpResult<'tcx, !>

Run the core interpreter loop. Returns only when an interrupt occurs (an error or program termination).

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

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