예제 #1
0
 public void StartRunning()
 {
     lock (_scheduler._sync) {
         if (_hasStarted)
         {
             throw new Exception("Work item has already started.");
         }
         _hasStarted = true;
         ThreadPoolManager.QueueWorkItem(_group, _action);
     }
 }
예제 #2
0
        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);
        }
예제 #3
0
 internal ThreadPoolThread(ThreadPoolManager manager)
 {
     _manager = manager;
 }