/// <summary> /// A default static constructor that initializes the pool threads. /// </summary> static SmartThreadPool() { //create a scheduler for threads created outside the computation system. //By default this is a heap scheduller since there can be much more threads, //thus heap sort is more efficient. artificialThreadScheduler = Configuration.ArtificialThreadScheduler; uint physicalProcessors = Unsafe.GetPhysicalCores(); //the idea here is {core_count} * 2 the rest should be spawned as fibers. ISchedulableThread[] threads = new ISchedulableThread[physicalProcessors * 2]; for (int i = 0; i < threads.Length; i++) { threads[i] = new SmartThread(true, -1); threads[i].SchedulableIndex = i; if (Configuration.SmartThreadPoolPreLoadThreads) { threads[i].Start(); } } //Load the default thread scheduler. threadScheduler = Configuration.SmartPoolScheduler; threadScheduler.Create(threads); }
static FiberPool() { ISchedulableThread[] threads = new ISchedulableThread[fiberThreadCount]; for (int i = 0; i < fiberThreadCount; i++) threads[i] = new FiberThread(); fiberScheduler = Configuration.FiberPoolScheduler; fiberScheduler.Create(threads); }
static FiberPool() { ISchedulableThread[] threads = new ISchedulableThread[fiberThreadCount]; for (int i = 0; i < fiberThreadCount; i++) { threads[i] = new FiberThread(); } fiberScheduler = Configuration.FiberPoolScheduler; fiberScheduler.Create(threads); }