Exemplo n.º 1
0
        /// <summary>
        ///   Creates a new instance of the <see cref="WorkThreadPool"/> class with the
        ///   specified <see cref="MinThreads"/> and <see cref="MaxThreads"/>.
        /// </summary>
        /// <param name="minThreads">
        ///   The mininum number of threads.
        /// </param>
        /// <param name="maxThreads">
        ///   The maximum number of threads.
        /// </param>
        /// <seealso cref="Default"/>
        public WorkThreadPool(int minThreads, int maxThreads)
        {
            if (0 >= maxThreads)
                throw new ArgumentOutOfRangeException("maxThreads", maxThreads, "Must be greater than zero.");

            workQueue = new HighPriorityQueue();
            workers = new ArrayList(maxThreads);

            this.maxThreads = maxThreads;
            MinThreads = minThreads;
        }
Exemplo n.º 2
0
 /// <summary>
 ///   Creates a new instance of the <see cref="WorkQueue"/> class.
 /// </summary>
 public WorkQueue()
 {
     queue = new HighPriorityQueue();
 }
Exemplo n.º 3
0
 public void Remove(ChunkCoordinates c)
 {
     HighPriorityQueue.TryRemove(c, out _);
     MidPriorityQueue.TryRemove(c, out _);
     LowPriorityQueue.TryRemove(c, out _);
 }
Exemplo n.º 4
0
 public bool HasPending()
 {
     return(HighPriorityQueue.Any(x => x.Value.Count > 0) || LowPriorityQueue.Any(x => x.Value.Count > 0) || MidPriorityQueue.Any(x => x.Value.Count > 0));
 }
Exemplo n.º 5
0
        public WorkQueue()
        {
            queue = new HighPriorityQueue();
            StopWatch = new Stopwatch();

        }
 public static HighPriorityQueue Syncronized(HighPriorityQueue P)
 {
     return new HighPriorityQueue(ArrayList.Synchronized(P.InnerList), P.Comparer, false);
 }