forked from SWE501-Spring2017-Bogazici/FinalProject
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathOutFreeEvent.cpp
More file actions
28 lines (24 loc) · 736 Bytes
/
OutFreeEvent.cpp
File metadata and controls
28 lines (24 loc) · 736 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
//
// Created by Can Candan on 04/06/17.
//
#include "OutFreeEvent.h"
#include "OutInEvent.h"
#include "TaskOutArrivalEvent.h"
#include "easylogging++.h"
OutFreeEvent::OutFreeEvent(Simulation *pSimulation, Task *pTask, double time, OutputDevice *pDevice) : Event(pSimulation, pTask, time) {
out=pDevice;
name="OutFreeEvent";
}
void OutFreeEvent::process() {
log();
out->setIdle(true);
if (!task->isFinished()) {
sim->addToRRQueue(task);
}
Task* newTask= sim->popFromRRQueue();
if (newTask) {
newTask->setWaitOut(newTask->getWaitOut()+(time-newTask->getOutTime()));
TaskOutArrivalEvent* event= new TaskOutArrivalEvent(sim, newTask, time);
sim->schedule(event);
}
}