Esempio n. 1
0
 public void Work(ClassWorkManager.Unit WorkUnit )
 {
     ReadyForWorkEvent.Reset();
       if (WorkUnit == null)
       {
     throw new Exception("Null work unit passed in");
       }
       this.WorkUnit = WorkUnit;
       WorkAvailable.Set();
 }
 public Unit(ClassWorkManager.WorkToDo CurrentWork , object Param ,UnitFinished Finished)
 {
     this.Finished=Finished;
     this.Param = Param;
     this.CurrentWork = CurrentWork;
 }
 public Unit(ClassWorkManager.WorkToDo CurrentWork , object Param )
 {
     this.Finished=null;
     this.Param = Param;
     this.CurrentWork = CurrentWork;
 }
        private void InitThread()
        {
            //Start Multithread
            ClassWorkManager.Unit[] work = null;
            ClassWorkManager.WorkFinished finished = null;

            ClassWorkManager.WorkToDo worktodo = new ClassWorkManager.WorkToDo(DoWork);
            //List of tasks
            int n = _listTSuite.Count;

            // each of work respect with a task
            work = new ClassWorkManager.Unit[n];
            for (int i = 0; i < n; i++)
            {
                work[i] = new ClassWorkManager.Unit(worktodo, _listTSuite[i]);
            }

            finished = new ClassWorkManager.WorkFinished(Finished);
            _Manager = new ClassWorkManager(this.numOfThread);
            _Manager.DoWork(work, finished);
        }