Exemplo n.º 1
0
        internal static Exception[] InternalProcess <T>(int capacity, T[] data, Action <T[]> process, int minSize) where T : class
        {
            if (capacity < 0)
            {
                throw new ArgumentOutOfRangeException("capacity");
            }

            if (data == null)
            {
                throw new ArgumentNullException("data");
            }

            if (process == null)
            {
                throw new ArgumentNullException("process");
            }

            if (0 == data.Length)
            {
                return(new Exception[0]);
            }

            var pool     = new ExecutionThreads(capacity);
            var threads  = pool.Capacity;
            var portions = Distribute(threads, data, minSize);

            foreach (var portion in portions)
            {
                pool.Enqueue(process, portion.ToArray());
            }

            return(pool.Join());
        }
Exemplo n.º 2
0
 internal ExecutionThread(Action target, ExecutionThreads pool) : this(pool)
 {
     Target = target;
     Thread = new Thread(ThreadProc)
     {
         Name = ThreadName, IsBackground = IS_BACKGROUND
     };
 }
Exemplo n.º 3
0
 internal ExecutionThread(ExecutionThreads pool)
 {
     _pool = pool;
 }