added callback dispose in ps handle

This commit is contained in:
Djeeberjr 2023-05-31 15:17:19 +02:00
parent 182a2bce7d
commit e11a9383ee

View File

@ -20,6 +20,7 @@ class ProcessHandle {
private final closeFuture: Future<Bool>; private final closeFuture: Future<Bool>;
private var closeFutureResolev: Bool -> Void; private var closeFutureResolev: Bool -> Void;
private final windowContexts: Array<WindowContext> = []; private final windowContexts: Array<WindowContext> = [];
private final cbLinks:Array<CallbackLink> = [];
@:allow(kernel.ps.ProcessManager) @:allow(kernel.ps.ProcessManager)
private function new(config: HandleConfig,pid: PID) { private function new(config: HandleConfig,pid: PID) {
@ -34,8 +35,6 @@ class ProcessHandle {
if (this.config.onExit != null) { if (this.config.onExit != null) {
this.closeFuture.handle(this.config.onExit); this.closeFuture.handle(this.config.onExit);
} }
this.closeFuture.eager();
} }
public function onExit(): Future<Bool> { public function onExit(): Future<Bool> {
@ -75,7 +74,17 @@ class ProcessHandle {
} }
private function dispose() { private function dispose() {
// TODO for (link in this.cbLinks) {
link.cancel();
}
}
public function getPid(): PID {
return this.pid;
}
public function addCallbackLink(link: CallbackLink) {
this.cbLinks.push(link);
} }
function get_args():ReadOnlyArray<String> { function get_args():ReadOnlyArray<String> {