private static void InitDefault() { lock (typeof(SpreadsThreadPool)) { if (_default == null) { var settings = new ThreadPoolSettings(DefaultDedicatedWorkerThreads, "DefaultSpreadsThreadPool"); _default = new SpreadsThreadPool(settings); ThreadPool.SetMinThreads(settings.NumThreads, settings.NumThreads); } } }
public PoolWorker(SpreadsThreadPool pool, int workerId) { _pool = pool; _threadExit = new TaskCompletionSource <object>(); var thread = new Thread(RunThread, pool.Settings.ThreadMaxStackSize); thread.IsBackground = pool.Settings.ThreadType == ThreadType.Background; thread.Priority = pool.Settings.ThreadPriority; if (pool.Settings.Name != null) { // TODO setting for same/diff name. Profiler merges threads with the same name which is better by default. thread.Name = pool.Settings.Name + "_worker"; //string.Format("{0}_{1}", pool.Settings.Name, workerId); } if (pool.Settings.ApartmentState != ApartmentState.Unknown) { thread.SetApartmentState(pool.Settings.ApartmentState); } thread.Start(); }
public SpreadsThreadPoolTaskScheduler(SpreadsThreadPool pool) { _pool = pool; }
#pragma warning restore 169 public ThreadPoolWorkQueue(SpreadsThreadPool pool) { _pool = pool; }