Browse Source

Document immediate-trap behavior of epochs (#4345)

Closes #4342
pull/3785/head
Alex Crichton 2 years ago
committed by GitHub
parent
commit
17ed95ad8c
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      crates/wasmtime/src/config.rs
  2. 8
      crates/wasmtime/src/store.rs

6
crates/wasmtime/src/config.rs

@ -449,9 +449,9 @@ impl Config {
/// not available. This means epoch-based interruption can only
/// serve as a simple external-interruption mechanism.
///
/// An initial deadline can be set before executing code by
/// calling
/// [`Store::set_epoch_deadline`](crate::Store::set_epoch_deadline).
/// An initial deadline must be set before executing code by calling
/// [`Store::set_epoch_deadline`](crate::Store::set_epoch_deadline). If this
/// deadline is not configured then wasm will immediately trap.
///
/// ## When to use fuel vs. epochs
///

8
crates/wasmtime/src/store.rs

@ -870,6 +870,10 @@ impl<T> Store<T> {
/// [`Engine::increment_epoch()`] has been invoked at least
/// `ticks_beyond_current` times.
///
/// By default a store will trap immediately with an epoch deadline of 0
/// (which has always "elapsed"). This method is required to be configured
/// for stores with epochs enabled to some future epoch deadline.
///
/// See documentation on
/// [`Config::epoch_interruption()`](crate::Config::epoch_interruption)
/// for an introduction to epoch-based interruption.
@ -896,6 +900,10 @@ impl<T> Store<T> {
/// finite interval. For deterministic interruption, see the
/// "fuel" mechanism instead.
///
/// Note that when this is used it's required to call
/// [`Store::set_epoch_deadline`] or otherwise wasm will always immediately
/// trap.
///
/// See documentation on
/// [`Config::epoch_interruption()`](crate::Config::epoch_interruption)
/// for an introduction to epoch-based interruption.

Loading…
Cancel
Save