wasmtime: Make StoreContextMut accessible in epoch deadline callback (#6075)
This commit changes the signature of the `Store::epoch_deadline_callback` to take in `StoreContextMut` instead of a mutable reference to the store's data. This is useful in cases in which the callback definition needs access to the Store to be able to use other methods that take in `AsContext`/`AsContextMut`, like for example `WasmtimeBacktrace::capture`
This commit is contained in:
@@ -32,7 +32,7 @@ fn make_env<T>(engine: &Engine) -> Linker<T> {
|
||||
|
||||
enum InterruptMode {
|
||||
Trap,
|
||||
Callback(fn(&mut usize) -> Result<u64>),
|
||||
Callback(fn(StoreContextMut<usize>) -> Result<u64>),
|
||||
Yield(u64),
|
||||
}
|
||||
|
||||
@@ -334,7 +334,8 @@ async fn epoch_callback_continue() {
|
||||
(func $subfunc))
|
||||
",
|
||||
1,
|
||||
InterruptMode::Callback(|s| {
|
||||
InterruptMode::Callback(|mut cx| {
|
||||
let s = cx.data_mut();
|
||||
*s += 1;
|
||||
Ok(1)
|
||||
}),
|
||||
|
||||
Reference in New Issue
Block a user