/// <summary> /// Wait will wait for the given task to complete, and then dispose /// the context. After Wait() returns, you should do nothing else to /// the context. /// </summary> public void Wait() { if (Worker == null) { throw new ObjectDisposedException("TaskContext.Wait()"); } Worker = null; Event.WaitOne(); ThreadPoolComponent.Reclaim(this); }
public void Dispose() { if (Worker == null) { throw new ObjectDisposedException("TaskContext.Dispose()"); } Worker.Context = null; Worker = null; ThreadPoolComponent.Reclaim(this); }