diff options
| author | Divy Srivastava <dj.srivastava23@gmail.com> | 2022-03-14 23:14:15 +0530 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-03-14 18:44:15 +0100 |
| commit | b4e42953e1d243f2eda20e5be6b845d60b7bf688 (patch) | |
| tree | 10b3bfff165f9c04f9174c7c399d44b9b724c3b3 /runtime/ops/signal.rs | |
| parent | 4e3ed37037a2aa1edeac260dc3463a81d9cf9b88 (diff) | |
feat(core): codegen ops (#13861)
Co-authored-by: Aaron O'Mullan <aaron.omullan@gmail.com>
Diffstat (limited to 'runtime/ops/signal.rs')
| -rw-r--r-- | runtime/ops/signal.rs | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/runtime/ops/signal.rs b/runtime/ops/signal.rs index 9511b83e2..d9f05a777 100644 --- a/runtime/ops/signal.rs +++ b/runtime/ops/signal.rs @@ -4,8 +4,8 @@ use deno_core::error::generic_error; #[cfg(not(target_os = "windows"))] use deno_core::error::type_error; use deno_core::error::AnyError; -use deno_core::op_async; -use deno_core::op_sync; +use deno_core::op; + use deno_core::Extension; use deno_core::OpState; use std::cell::RefCell; @@ -31,9 +31,9 @@ use tokio::signal::unix::{signal, Signal, SignalKind}; pub fn init() -> Extension { Extension::builder() .ops(vec![ - ("op_signal_bind", op_sync(op_signal_bind)), - ("op_signal_unbind", op_sync(op_signal_unbind)), - ("op_signal_poll", op_async(op_signal_poll)), + op_signal_bind::decl(), + op_signal_unbind::decl(), + op_signal_poll::decl(), ]) .build() } @@ -174,6 +174,7 @@ pub fn signal_str_to_int(s: &str) -> Result<libc::c_int, AnyError> { } #[cfg(unix)] +#[op] fn op_signal_bind( state: &mut OpState, sig: String, @@ -195,6 +196,7 @@ fn op_signal_bind( } #[cfg(unix)] +#[op] async fn op_signal_poll( state: Rc<RefCell<OpState>>, rid: ResourceId, @@ -214,6 +216,7 @@ async fn op_signal_poll( } #[cfg(unix)] +#[op] pub fn op_signal_unbind( state: &mut OpState, rid: ResourceId, @@ -224,6 +227,7 @@ pub fn op_signal_unbind( } #[cfg(not(unix))] +#[op] pub fn op_signal_bind( _state: &mut OpState, _: (), @@ -233,6 +237,7 @@ pub fn op_signal_bind( } #[cfg(not(unix))] +#[op] fn op_signal_unbind( _state: &mut OpState, _: (), @@ -242,6 +247,7 @@ fn op_signal_unbind( } #[cfg(not(unix))] +#[op] async fn op_signal_poll( _state: Rc<RefCell<OpState>>, _: (), |
