internal WorkerThread(string name, ThreadPoolSynchronizer context) { this.m_Context = context; this.m_EndLoop = false; this.m_ThreadObj = null; this.m_ThreadObj = new Thread(new ThreadStart(this.Run)); this.m_ThreadObj.IsBackground = true; this.m_ThreadObj.Name = name; this.m_ThreadObj.Start(); }
internal static void ApplyDispatchBehavior(ThreadPoolSynchronizer synchronizer, uint poolSize, Type type, string poolName, DispatchRuntime dispatch) { int num = 16; if (dispatch.ChannelDispatcher.ServiceThrottle != null) { num = dispatch.ChannelDispatcher.ServiceThrottle.MaxConcurrentCalls; } if ((long)num < (long)((ulong)poolSize)) { throw new InvalidOperationException("The throttle should allow at least as many concurrent calls as the pool size"); } ThreadPoolHelper.HasSynchronizer(type); if (!ThreadPoolHelper.HasSynchronizer(type)) { ThreadPoolHelper.m_Synchronizers[type] = synchronizer; } dispatch.SynchronizationContext = synchronizer; }