示例#1
0
 static TimedExecutorPool()
 {
     PoolCount = Math.Max(1, Math.Min(Environment.ProcessorCount / 2, 4));
     pools     = new TimedBlockingExecutor[PoolCount];
     for (int i = 0; i < PoolCount; i++)
     {
         pools[i] = new TimedBlockingExecutor("TimedExecutorWorker-" + (i + 1));
     }
 }
 internal IOExecutorService()
 {
     guard           = new object();
     queue           = ShutdownQueue;
     executors       = new HashSet <SingleThreadedExecutor>();
     timed           = new TimedBlockingExecutor("IOExecutorService:Cleanup");
     ttlMilliseconds = 60 * 1000;
     Start();
 }
        internal BlockingExecutorService(string name, bool ownTimer, bool daemon)
        {
            if (name == null)
            {
                name = "BlockingExecutorService-" + Interlocked.Increment(ref index);
            }

            runner = new BlockingQueueConsumer(Flowable.BufferSize(), name, daemon);

            if (ownTimer)
            {
                this.timed = new TimedBlockingExecutor(name + ":Timed");
            }
            else
            {
                this.timed = TimedExecutorPool.TimedExecutor;
            }
        }
示例#4
0
 internal SingleThreadedExecutor(string name)
 {
     runner    = new BlockingQueueConsumer(Flowable.BufferSize(), name);
     timed     = TimedExecutorPool.TimedExecutor;
     this.name = name;
 }