예제 #1
0
        public void OnTimer(Object state)
        {
            lock (this)
            {
                if (workItems.Count == 0)
                {
                    return;
                }

                if (activeThreads < MaxThreads)
                {
                    WorkThread.AddWorker(this);
                }
            }
        }
예제 #2
0
 public bool QueueUserWorkItem(WaitCallback callback, Object state)
 {
     if (null == callback)
     {
         return(false);
     }
     lock (this)
     {
         workItems.Push(new WorkItem(callback, state));
         if (activeThreads == 0)
         {
             WorkThread.AddWorker(this);
         }
         return(true);
     }
 }