Ejemplo n.º 1
0
 public ClassWorkManager.Unit GetResults()
 {
     ClassWorkManager.Unit TempWorkUnit;
       TempWorkUnit=this.WorkUnit;
       this.WorkUnit = null;
       ReadyForWorkEvent.Set();
       return TempWorkUnit ;
 }
Ejemplo n.º 2
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();
 }
Ejemplo n.º 3
0
        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);
        }