Example #1
0
 public void f_actionJobs(JOB_HANDLE action)
 {
     foreach (var kv in this.JobHandles)
     {
         kv.Value.f_actionJob(action);
     }
 }
Example #2
0
        public JobHandle(IJob job)
        {
            this.Job   = job;
            this.State = JOB_HANDLE.RUN;

            this.HandleJob = ThreadPool.RegisterWaitForSingleObject(
                new AutoResetEvent(false),
                new WaitOrTimerCallback((state, timeOut) => { this.Job.f_runLoop(this); }),
                this,
                JOB_CONST.JOB_TIMEOUT_RUN,
                true); /* true: run once; false: repeate */
        }
Example #3
0
        public void f_actionJob(JOB_HANDLE action)
        {
            if (this.State == action)
            {
                return;
            }
            switch (action)
            {
            case JOB_HANDLE.RUN:
                this.State = action;
                //this.HandleJob = ThreadPool.RegisterWaitForSingleObject(
                //    this.EvenStopLoop,
                //    new WaitOrTimerCallback(this.Job.f_runLoop),
                //    this,
                //    JOB_CONST.JOB_TIMEOUT_RUN,
                //    false);
                break;

            case JOB_HANDLE.PAUSE:
                this.State = action;
                f_postEventStopLoop();
                break;

            case JOB_HANDLE.STOP:
                this.State = action;
                f_postEventStopLoop();
                break;

            case JOB_HANDLE.RESET:
                this.State = action;
                f_postEventStopLoop();
                break;

            case JOB_HANDLE.REMOVE:
                this.State = action;
                f_postEventStopLoop();
                break;

            case JOB_HANDLE.CLEAR:
                break;
            }
        }
Example #4
0
 public void f_jobFactoryStateChanged(IJob job, JOB_HANDLE state)
 {
     Tracer.WriteLine("JOB_FACTORY STATE CHANGED: {0}.{1} = {2}", job.Type, job.f_getId(), state);
 }
Example #5
0
 public void f_jobSingletonStateChanged(IJob job, JOB_HANDLE state)
 {
     Tracer.WriteLine("JOB_SINGLETON STATE CHANGED: {0}.{1} = {2}", job.Type, job.f_getId(), state);
 }
Example #6
0
 public void f_actionJobs(JOB_HANDLE action)
 {
     this.JobHandles.ExecuteFunc(JOB_ACTION, action);
 }