private void InternalReset() { lock (this.currentProcessLock) this.currentProcess = (AsyncProcess)null; this.completedCount = 0; this.count = 0; lock (this.queue) this.queue.Clear(); }
public override void Kill() { lock (this.currentProcessLock) { if (this.currentProcess != null) { this.currentProcess.Kill(); this.currentProcess = (AsyncProcess)null; } } base.Kill(); }
protected override void InternalPause() { base.InternalPause(); lock (this.currentProcessLock) { if (this.currentProcess == null) { return; } this.completedCount -= this.currentProcess.CompletedCount; this.currentProcess.Finish(); this.completedCount += this.currentProcess.CompletedCount; this.currentProcess = (AsyncProcess)null; } }
public void Add(AsyncProcess job, bool beginProcessingAgain) { this.count += job.Count; this.completedCount += job.CompletedCount; bool flag; lock (this.queue) { flag = this.queue.Count == 0; this.queue.Enqueue(job); } if (!flag || !beginProcessingAgain || this.IsPaused) { return; } this.Begin(); }
protected override void Work() { if (!this.IsAlive) { return; } lock (this.currentProcessLock) { if (this.currentProcess == null) { return; } AsyncProcess local_0 = this.currentProcess; this.completedCount -= local_0.CompletedCount; this.currentProcess.WorkWrapper(); this.completedCount += local_0.CompletedCount; } }
protected override bool MoveNext() { if (!this.IsAlive || this.IsPaused) { return(false); } lock (this.currentProcessLock) { if (this.currentProcess == null || !this.currentProcess.MoveNextWrapper()) { lock (this.queue) { while (this.queue.Count > 0) { this.currentProcess = this.queue.Dequeue(); this.currentProcess.Begin(); if (this.currentProcess != null) { if (this.currentProcess.MoveNextWrapper()) { goto label_13; } } else { goto label_13; } } this.currentProcess = (AsyncProcess)null; return(false); } } label_13: return(true); } }
public void Add(AsyncProcess newProcess) { this.processes.Add(newProcess); }
protected override void InternalBegin() { lock (this.currentProcessLock) this.currentProcess = (AsyncProcess)null; }