diff options
Diffstat (limited to 'core/runtime.rs')
-rw-r--r-- | core/runtime.rs | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/core/runtime.rs b/core/runtime.rs index 21e6e7570..376e0beb4 100644 --- a/core/runtime.rs +++ b/core/runtime.rs @@ -2203,6 +2203,22 @@ impl JsRealm { } #[inline] +pub fn queue_fast_async_op( + ctx: &OpCtx, + op: impl Future<Output = (PromiseId, OpId, OpResult)> + 'static, +) { + let runtime_state = match ctx.runtime_state.upgrade() { + Some(rc_state) => rc_state, + // atleast 1 Rc is held by the JsRuntime. + None => unreachable!(), + }; + + let mut state = runtime_state.borrow_mut(); + state.pending_ops.push(OpCall::lazy(op)); + state.have_unpolled_ops = true; +} + +#[inline] pub fn queue_async_op( ctx: &OpCtx, scope: &mut v8::HandleScope, |