Skip to content

Commit 79fd571

Browse files
committed
squash! add to async runtime
1 parent 35502b6 commit 79fd571

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

core/src/runtime/async.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use async_lock::Mutex;
1313

1414
use super::{
1515
opaque::Opaque, raw::RawRuntime, schedular::SchedularPoll, spawner::DriveFuture,
16-
InterruptHandler, MemoryUsage,
16+
InterruptHandler, MemoryUsage, PromiseHook,
1717
};
1818
use crate::allocator::Allocator;
1919
#[cfg(feature = "loader")]
@@ -160,6 +160,14 @@ impl AsyncRuntime {
160160
}
161161
}
162162

163+
/// Set a closure which is called when a promise is created, resolved, or chained.
164+
#[inline]
165+
pub async fn set_promise_hook(&self, tracker: Option<PromiseHook>) {
166+
unsafe {
167+
self.inner.lock().await.runtime.set_promise_hook(tracker);
168+
}
169+
}
170+
163171
/// Set a closure which is regularly called by the engine when it is executing code.
164172
/// If the provided closure returns `true` the interpreter will raise and uncatchable
165173
/// exception and return control flow to the caller.

0 commit comments

Comments
 (0)