From dd2e9a4993372dfb1130f15934f6a9d8b86ed6d1 Mon Sep 17 00:00:00 2001 From: Djeeberjr Date: Mon, 29 May 2023 12:49:17 +0200 Subject: [PATCH] added kill to ProcessManager --- src/kernel/ps/ProcessManager.hx | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/kernel/ps/ProcessManager.hx b/src/kernel/ps/ProcessManager.hx index 1e71d1a..7001ea7 100644 --- a/src/kernel/ps/ProcessManager.hx +++ b/src/kernel/ps/ProcessManager.hx @@ -2,6 +2,8 @@ package kernel.ps; import kernel.ps.ProcessHandle.HandleConfig; +using tink.CoreApi; + typedef PID = Int; class ProcessManager { @@ -18,6 +20,16 @@ class ProcessManager { return pid; } + public static function kill(pid: PID) { + if (!processList.exists(pid)){ + throw new Error("Process with PID " + pid + " does not exist"); + } + + var handle = processList.get(pid); + + handle.close(); + } + private static function createPID(): PID { // TODO: better PID generation