summaryrefslogtreecommitdiff
path: root/cli/js/ops/signal.ts
blob: 15093a3c43aa37a2f954cc8b415faa7b84070806 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.

import { sendSync, sendAsync } from "./dispatch_json.ts";

interface BindSignalResponse {
  rid: number;
}

interface PollSignalResponse {
  done: boolean;
}

export function bindSignal(signo: number): BindSignalResponse {
  return sendSync("op_signal_bind", { signo });
}

export function pollSignal(rid: number): Promise<PollSignalResponse> {
  return sendAsync("op_signal_poll", { rid });
}

export function unbindSignal(rid: number): void {
  sendSync("op_signal_unbind", { rid });
}