Example #1
0
 private void InternalReset()
 {
     lock (this.currentProcessLock)
         this.currentProcess = (AsyncProcess)null;
     this.completedCount = 0;
     this.count          = 0;
     lock (this.queue)
         this.queue.Clear();
 }
Example #2
0
 public override void Kill()
 {
     lock (this.currentProcessLock)
     {
         if (this.currentProcess != null)
         {
             this.currentProcess.Kill();
             this.currentProcess = (AsyncProcess)null;
         }
     }
     base.Kill();
 }
Example #3
0
 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;
     }
 }
Example #4
0
        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();
        }
Example #5
0
 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;
     }
 }
Example #6
0
        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);
            }
        }
Example #7
0
 public void Add(AsyncProcess newProcess)
 {
     this.processes.Add(newProcess);
 }
Example #8
0
 protected override void InternalBegin()
 {
     lock (this.currentProcessLock)
         this.currentProcess = (AsyncProcess)null;
 }