2020-03-09 10:18:02 -04:00
|
|
|
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
|
2020-07-06 21:45:39 -04:00
|
|
|
|
2020-03-09 10:18:02 -04:00
|
|
|
import { sendSync, sendAsync } from "./dispatch_json.ts";
|
|
|
|
|
2020-07-06 21:45:39 -04:00
|
|
|
interface BindSignalResponse {
|
|
|
|
rid: number;
|
|
|
|
}
|
|
|
|
|
|
|
|
interface PollSignalResponse {
|
|
|
|
done: boolean;
|
|
|
|
}
|
|
|
|
|
|
|
|
export function bindSignal(signo: number): BindSignalResponse {
|
2020-03-09 10:18:02 -04:00
|
|
|
return sendSync("op_signal_bind", { signo });
|
|
|
|
}
|
|
|
|
|
2020-07-06 21:45:39 -04:00
|
|
|
export function pollSignal(rid: number): Promise<PollSignalResponse> {
|
2020-03-16 05:22:16 -04:00
|
|
|
return sendAsync("op_signal_poll", { rid });
|
2020-03-09 10:18:02 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
export function unbindSignal(rid: number): void {
|
|
|
|
sendSync("op_signal_unbind", { rid });
|
|
|
|
}
|