예제 #1
0
 /// <summary>
 /// Initialises a new instance of the JobScheduler class.
 /// </summary>
 /// <param name="threadCount">The number of threads to spawn.</param>
 public JobScheduler(int threadCount)
 {
     this.masterQueue = new MasterJobQueue();
     this.masterQueueJobs = new List<Job>();
     this.chunkQueues = new Dictionary<Vector2I, ChunkJobQueue>();
     this.jobPool = new JobPool(threadCount);
     this.queuesLock = new SpinLock(10);
 }
예제 #2
0
 /// <summary>
 /// Adds owner queues.
 /// </summary>
 /// <param name="owners">The owners.</param>
 public override void AddOwners(params JobQueue[] owners)
 {
     base.AddOwners(owners);
     foreach (JobQueue owner in owners)
     {
         if (owner is MasterJobQueue)
         {
             this.masterQueue = (MasterJobQueue)owner;
         }
     }
 }