public void StartRunning() { lock (_scheduler._sync) { if (_hasStarted) { throw new Exception("Work item has already started."); } _hasStarted = true; ThreadPoolManager.QueueWorkItem(_group, _action); } }
public static void QueueWorkItem(string group, Action action) { ThreadPoolManager manager; lock (_threadPoolManagers) { if (!_threadPoolManagers.TryGetValue(group, out manager)) { manager = new ThreadPoolManager(); _threadPoolManagers[group] = manager; } } manager.QueueWorkItem(action); }
internal ThreadPoolThread(ThreadPoolManager manager) { _manager = manager; }