diff options
author | Bartek IwaĆczuk <biwanczuk@gmail.com> | 2020-03-09 15:18:02 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-09 15:18:02 +0100 |
commit | 886f330ec8110a3eb72feb14353f353962179d2e (patch) | |
tree | f6b458afac30a18d5120396bed9b1e63ae6d8529 /cli/js/signals.ts | |
parent | 1b6fc87b7188118896f797e5f0dab309775def71 (diff) |
reorg: move JS ops implementations to cli/js/ops/, part 2 (#4283)
Following JS ops were moved to separate files in cli/js/ops directory:
- io
- process
- worker_host
- web_worker
- plugins
- timers
- signal
- permissions
Diffstat (limited to 'cli/js/signals.ts')
-rw-r--r-- | cli/js/signals.ts | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/cli/js/signals.ts b/cli/js/signals.ts index 71ac32ae9..2715cfa50 100644 --- a/cli/js/signals.ts +++ b/cli/js/signals.ts @@ -1,6 +1,6 @@ // Copyright 2018-2020 the Deno authors. All rights reserved. MIT license. import { Signal } from "./process.ts"; -import { sendSync, sendAsync } from "./ops/dispatch_json.ts"; +import { bindSignal, pollSignal, unbindSignal } from "./ops/signal.ts"; import { build } from "./build.ts"; /** @@ -105,16 +105,13 @@ export class SignalStream /** The flag, which is true when the stream is disposed. */ private disposed = false; constructor(signo: number) { - this.rid = sendSync("op_signal_bind", { signo }).rid; + this.rid = bindSignal(signo).rid; this.loop(); } private async pollSignal(): Promise<boolean> { - return ( - await sendAsync("op_signal_poll", { - rid: this.rid - }) - ).done; + const res = await pollSignal(this.rid); + return res.done; } private async loop(): Promise<void> { @@ -143,6 +140,6 @@ export class SignalStream throw new Error("The stream has already been disposed."); } this.disposed = true; - sendSync("op_signal_unbind", { rid: this.rid }); + unbindSignal(this.rid); } } |