Inheritance: IEngineTask
Esempio n. 1
0
        /// <summary>
        /// Start the job, block until its done.
        /// </summary>
        public virtual void Process()
        {
            _totalTasks = LoadWorkload();

            if (ThreadCount == 1)
            {
                Object task;
                int    currentTask = 0;

                while ((task = RequestNextTask()) != null)
                {
                    currentTask++;
                    var context = new JobUnitContext {
                        JobUnit = task, Owner = this, TaskNumber = currentTask
                    };
                    var worker = new JobUnitWorker(context);
                    worker.Run();
                }
            }
            else
            {
                Parallel.For(0, _totalTasks, currentTask =>
                {
                    Object task = RequestNextTask();
                    var context = new JobUnitContext {
                        JobUnit = task, Owner = this, TaskNumber = currentTask
                    };
                    var worker = new JobUnitWorker(context);
                    worker.Run();
                });
            }
        }
        /// <summary>
        /// Start the job, block until its done.
        /// </summary>
        public virtual void Process()
        {
            Object task;

            EngineConcurrency.Instance.ThreadCount = ThreadCount;

            TaskGroup group = EngineConcurrency.Instance.CreateTaskGroup();

            _totalTasks = LoadWorkload();
            int currentTask = 0;

            while ((task = RequestNextTask()) != null)
            {
                currentTask++;
                var context = new JobUnitContext {
                    JobUnit = task, Owner = this, TaskNumber = currentTask
                };

                var worker = new JobUnitWorker(context);
                EngineConcurrency.Instance.ProcessTask(worker, group);
            }

            group.WaitForComplete();
        }
Esempio n. 3
0
        /// <summary>
        /// Start the job, block until its done.
        /// </summary>
        public virtual void Process()
        {
            _totalTasks = LoadWorkload();

            if (ThreadCount == 1)
            {
                Object task;
                int currentTask = 0;

                while ((task = RequestNextTask()) != null)
                {
                    currentTask++;
                    var context = new JobUnitContext { JobUnit = task, Owner = this, TaskNumber = currentTask };
                    var worker = new JobUnitWorker(context);
                    worker.Run();
                }
            }
            else
            {
                Parallel.For(0, _totalTasks, currentTask =>
                {
                    Object task = RequestNextTask();
                    var context = new JobUnitContext { JobUnit = task, Owner = this, TaskNumber = currentTask };
                    var worker = new JobUnitWorker(context);
                    worker.Run();

                });
            }
        }
Esempio n. 4
0
        /// <summary>
        /// Start the job, block until its done.
        /// </summary>
        public virtual void Process()
        {
            Object task;

            TaskGroup group = EngineConcurrency.Instance.CreateTaskGroup();

            _totalTasks = LoadWorkload();
            int currentTask = 0;

            while ((task = RequestNextTask()) != null)
            {
                currentTask++;
                var context = new JobUnitContext {JobUnit = task, Owner = this, TaskNumber = currentTask};

                var worker = new JobUnitWorker(context);
                EngineConcurrency.Instance.ProcessTask(worker, group);
            }

            group.WaitForComplete();
        }
Esempio n. 5
0
 public virtual void Process()
 {
     object obj2;
     TaskGroup group;
     int num;
     JobUnitContext context;
     JobUnitContext context2;
     EngineConcurrency.Instance.ThreadCount = this.ThreadCount;
     if (0 == 0)
     {
         group = EngineConcurrency.Instance.CreateTaskGroup();
         this._x5cd5268c7a8f6ac5 = this.LoadWorkload();
         num = 0;
     }
     Label_0015:
     while ((obj2 = this.RequestNextTask()) != null)
     {
         num++;
         context2 = new JobUnitContext {
             JobUnit = obj2,
             Owner = this
         };
         if ((((uint) num) - ((uint) num)) > uint.MaxValue)
         {
             goto Label_0032;
         }
         if (0x7fffffff != 0)
         {
             context2.TaskNumber = num;
             goto Label_0032;
         }
     }
     group.WaitForComplete();
     return;
     Label_0032:
     context = context2;
     JobUnitWorker task = new JobUnitWorker(context);
     EngineConcurrency.Instance.ProcessTask(task, group);
     goto Label_0015;
 }