Example #1
0
 internal void Push(thread thread)
 {
     if (isDisposed)
     {
         thread.Stop();
     }
     else
     {
         threads.Push(thread);
         if (isDisposed)
         {
             disposePool();
         }
     }
 }
Example #2
0
 /// <summary>
 /// 线程入池
 /// </summary>
 /// <param name="thread">线程池线程</param>
 internal void Push(thread thread)
 {
     while (Interlocked.CompareExchange(ref threadLock, 1, 0) != 0)
     {
         Thread.Sleep(1);
     }
     try
     {
         if (isDisposed)
         {
             thread.Stop();
         }
         else
         {
             threads.Add(thread);
         }
     }
     finally { threadLock = 0; }
 }