added windowContext to ProcessHandle
This commit is contained in:
@@ -2,10 +2,36 @@ package kernel.ps;
|
||||
|
||||
import kernel.ps.ProcessHandle.HandleConfig;
|
||||
|
||||
typedef PID = Int;
|
||||
|
||||
class ProcessManager {
|
||||
public static function run(process:Process, config: HandleConfig):ProcessHandle {
|
||||
var handle = new ProcessHandle(config);
|
||||
private static final processList = new Map<PID,ProcessHandle>();
|
||||
|
||||
public static function run(process:Process, config: HandleConfig):PID {
|
||||
var pid = createPID();
|
||||
var handle = new ProcessHandle(config, pid);
|
||||
|
||||
processList.set(pid, handle);
|
||||
|
||||
process.run(handle);
|
||||
return handle;
|
||||
|
||||
return pid;
|
||||
}
|
||||
|
||||
private static function createPID(): PID {
|
||||
// TODO: better PID generation
|
||||
|
||||
// generate a random PID
|
||||
return Math.ceil(Math.random() * 1000000);
|
||||
}
|
||||
|
||||
@:allow(kernel.ui.WindowManager)
|
||||
private static function getProcess(pid:PID):Null<ProcessHandle>{
|
||||
return processList.get(pid);
|
||||
}
|
||||
|
||||
@:allow(kernel.ps.ProcessHandle)
|
||||
private static function removeProcess(pid:PID):Void {
|
||||
processList.remove(pid);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user