示例#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);
     }
 }