added kill to ProcessManager
This commit is contained in:
parent
eb39131056
commit
dd2e9a4993
@ -2,6 +2,8 @@ package kernel.ps;
|
|||||||
|
|
||||||
import kernel.ps.ProcessHandle.HandleConfig;
|
import kernel.ps.ProcessHandle.HandleConfig;
|
||||||
|
|
||||||
|
using tink.CoreApi;
|
||||||
|
|
||||||
typedef PID = Int;
|
typedef PID = Int;
|
||||||
|
|
||||||
class ProcessManager {
|
class ProcessManager {
|
||||||
@ -18,6 +20,16 @@ class ProcessManager {
|
|||||||
return pid;
|
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 {
|
private static function createPID(): PID {
|
||||||
// TODO: better PID generation
|
// TODO: better PID generation
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user