Sharpen.ThreadPoolExecutor.RunPoolThread C# (CSharp) Method

RunPoolThread() public method

public RunPoolThread ( ) : void
return void
		public void RunPoolThread ()
		{
			while (!IsTerminated ()) {
				try {
					Runnable r = null;
					lock (pendingTasks) {
						freeThreads++;
						while (!IsTerminated () && pendingTasks.Count == 0)
							ST.Monitor.Wait (pendingTasks);
						if (IsTerminated ())
							break;
						r = pendingTasks.Dequeue ();
					}
					if (r != null)
						r.Run ();
				}
				catch (ST.ThreadAbortException) {
					// Do not catch a thread abort. If we've been aborted just let the thread die.
					// Currently reseting an abort which was issued because the appdomain is being
					// torn down results in the process living forever and consuming 100% cpu time.
					return;
				}
				catch {
				}
			}
		}