Esempio n. 1
0
        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;
        }
Esempio n. 2
0
        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);
        }
Esempio n. 3
0
 /// <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;
       }
 }
Esempio n. 4
0
 private void Processor_SlotFreed(int freeSlots, ProcessEx finishedProcess)
 {
     this.LaunchQueue();
 }
Esempio n. 5
0
        public void QueueProcess(ProcessEx process)
        {
            if (process == null)
            throw new ArgumentNullException("Process can not be null");

              this.QueueProcess(process, ProcessPriorityClass.Normal);
        }
Esempio n. 6
0
        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);
        }