示例#1
0
 function run($iterations)
 {
     global $taskWorkArea;
     for ($i = 0; $i < $iterations; $i++) {
         $taskWorkArea->holdCount = 0;
         $taskWorkArea->qpktCount = 0;
         $task_state = new TaskState();
         new IdleTask(I_IDLE, 1, 10000, $task_state->running(), new IdleTaskRec());
         $wkq = new Packet(null, 0, K_WORK);
         $wkq = new Packet($wkq, 0, K_WORK);
         $task_state = new TaskState();
         new WorkTask(I_WORK, 1000, $wkq, $task_state->waitingWithPacket(), new WorkTaskRec());
         $wkq = new Packet(null, I_DEVA, K_DEV);
         $wkq = new Packet($wkq, I_DEVA, K_DEV);
         $wkq = new Packet($wkq, I_DEVA, K_DEV);
         $task_state = new TaskState();
         new HandlerTask(I_HANDLERA, 2000, $wkq, $task_state->waitingWithPacket(), new HandlerTaskRec());
         $wkq = new Packet(null, I_DEVB, K_DEV);
         $wkq = new Packet($wkq, I_DEVB, K_DEV);
         $wkq = new Packet($wkq, I_DEVB, K_DEV);
         $task_state = new TaskState();
         new HandlerTask(I_HANDLERB, 3000, $wkq, $task_state->waitingWithPacket(), new HandlerTaskRec());
         $wkq = null;
         $task_state = new TaskState();
         new DeviceTask(I_DEVA, 4000, $wkq, $task_state->waiting(), new DeviceTaskRec());
         $task_state = new TaskState();
         new DeviceTask(I_DEVB, 5000, $wkq, $task_state->waiting(), new DeviceTaskRec());
         schedule();
         if (!($taskWorkArea->holdCount == 9297 && $taskWorkArea->qpktCount == 23246)) {
             return false;
         }
     }
     return true;
 }