public bool Kill(ProcessEx process) { if (process == null) throw new ArgumentNullException("process can not be null"); foreach (var core in this._cores) { if (core.Process == process) { core.Kill(); return true; } } return false; }
public void Run(ProcessEx process, ProcessPriorityClass priority) { if (this.Status.InUse) throw new InvalidOperationException("Current core is running another process"); if (process == null) throw new ArgumentNullException("Process can not be null"); this.Process = process; this.Process.ExecutingCore = this; //bind event this.Process.Exited += Process_Exited; this.Process.Start(); this.Process.Status = ProcessExecutionStatus.Running; this.Process.PriorityClass = priority; this.Status.InUse = true; //TODO set affinity this.Process.ProcessorAffinity = (IntPtr) (int) Math.Pow(2, this.Status.Index); }
/// <summary> /// Queues the process. /// </summary> /// <param name="process">The process to enqueue.</param> /// <param name="prc">process priority.</param> public void QueueProcess(ProcessEx process, ProcessPriorityClass prc) { lock (_queueLock) { this._processQueue.Enqueue(new KeyValuePair<ProcessEx, ProcessPriorityClass>(process, prc)); process.Status = ProcessExecutionStatus.Queued; } }
private void Processor_SlotFreed(int freeSlots, ProcessEx finishedProcess) { this.LaunchQueue(); }
public void QueueProcess(ProcessEx process) { if (process == null) throw new ArgumentNullException("Process can not be null"); this.QueueProcess(process, ProcessPriorityClass.Normal); }
public void Run(ProcessEx process, ProcessPriorityClass prc) { if (process == null) throw new ArgumentNullException("process can not be null"); var core = this.GetFirstFreeCore(); core.Run(process, prc); }