Skip to main content

EvalContextExt

Trait EvalContextExt 

Source
pub trait EvalContextExt<'tcx>: MiriInterpCxExt<'tcx> {
    // Provided methods
    fn block_thread_for_io(
        &mut self,
        source_fd: FileDescriptionRef<dyn SourceFileDescription>,
        interest: BlockingIoInterest,
        deadline: Option<Deadline>,
        callback: DynUnblockCallback<'tcx>,
    ) -> InterpResult<'tcx> { ... }
    fn poll_and_unblock(
        &mut self,
        timeout: Option<Duration>,
    ) -> InterpResult<'tcx> { ... }
}

Provided Methods§

Source

fn block_thread_for_io( &mut self, source_fd: FileDescriptionRef<dyn SourceFileDescription>, interest: BlockingIoInterest, deadline: Option<Deadline>, callback: DynUnblockCallback<'tcx>, ) -> InterpResult<'tcx>

Block the current thread until some interests on an I/O source are fulfilled or the optional timeout exceeded. The callback will be invoked when the thread gets unblocked.

Note that an error interest is implicitly added to interest. This means that the thread will also be unblocked when the error readiness gets set for the source even when the requested interest might not be fulfilled.

The callback function will immediately be executed with UnblockKind::Ready when interest is already fulfilled for source_fd.

There can also be spurious wake-ups by the OS and thus it’s the callers responsibility to verify that the requested I/O interests are really ready and to block again if they’re not.

It’s the callers responsibility to remove the BlockingIoInterest from the blocking I/O manager in the provided callback function.

Source

fn poll_and_unblock(&mut self, timeout: Option<Duration>) -> InterpResult<'tcx>

Poll for I/O events until either an I/O event happened or the timeout expired.

  • If the timeout is Some and contains Duration::ZERO, the poll doesn’t block and just reads all events since the last poll.
  • If the timeout is Some and contains a non-zero duration, it blocks at most for the specified duration.
  • If the timeout is None the poll blocks indefinitely until an event occurs.

Unblocks all threads which are blocked on I/O and whose I/O interests are currently fulfilled.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

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