Scheduler
waiting.cpp
Go to the documentation of this file.
1 
10 #include "waiting.h"
11 
12 #include <cassert>
13 
14 #include <scheduler/queue.h>
15 #include <scheduler/process.h>
17 #include <scheduler/system.h>
18 
19 #include "ready.h"
20 
21 using namespace Scheduler;
22 
23 
25 {
26  assert(task != nullptr);
28  print();
29  std::shared_ptr<Event> e = std::make_shared<Ready>(time + task->getCurrentIoTime());
30  e->setTask(task);
33  scheduler->clearRunningTask(task);
34  scheduler->scheduleTask(eventType);
35  return;
36 }
37 
38 std::string Waiting::getName()
39 {
40  return "Task waiting";
41 }
42 
std::shared_ptr< Process > task
Definition: event.h:60
virtual void print()
print information about the event
Definition: event.cpp:41
static System * getInstance()
Definition: system.cpp:28
static Queue * getWaitQueue()
get a pointer to the system&#39;s wait queue
Definition: queue.cpp:37
void scheduleTask(TriggeringEvent trigger)
This function is the scheduler. When called, it schedule the task to be executed on the processor ama...
void process() override
handle the the event TODO: &#39;process&#39; is maybe not the best word for that, given that our simulator ac...
Definition: waiting.cpp:24
TaskScheduler * getScheduler()
returns the task scheduler object
Definition: system.cpp:110
void clearRunningTask(std::shared_ptr< Process > p)
std::shared_ptr< Event > insert(std::shared_ptr< Event > e)
Definition: eventList.cpp:56
TriggeringEvent eventType
The event type is need by the scheduling discipline, to determine if this kind of event triggers invo...
Definition: event.h:64
std::string getName() override
get the name of the event
Definition: waiting.cpp:38
void add(std::shared_ptr< Process > p)
add a process to the queue
Definition: queue.cpp:23
static EventList * getInstance()
Singleton pattern.
Definition: eventList.cpp:22
double time
Definition: event.h:58