internal void AddWorker(IThreadPoolWorker pg) { AutoResetEvent autoEvent = new AutoResetEvent(false); autoEvents.Add(autoEvent); ThreadPool.QueueUserWorkItem(new WaitCallback(pg.ThreadPoolJob), autoEvent); }
/// <summary> /// Enqueue an item of /// </summary> /// <param name="Worker"></param> public void Enqueue(IThreadPoolWorker Worker) { if (Interlocked.Increment(ref NumOutstandingJobs) == 1) { EmptyEvent.Reset(); } ThreadPool.QueueUserWorkItem(Execute, Worker); }