I'm implementing a BOOOS - Basic oriented-Object Operational System, and now I need to make my program's scheduler choose between FCFS and Priority. I have a class called Task, where I create two queues: std::queue and a std::priority_queue. Those queues are static members declared in Task.h, and I need to initialize then before any other thing in the Task.cc with the others static members of the class, like this:
namespace BOOOS {
volatile Task * Task::__running;
Task * Task::__main;
int Task::__tid_count;
int Task::__task_count;
std::queue<Task*> Task::__ready;
std::priority_queue<Task*> Task::__ready;
(rest of the Task.cc)
}
You can see that I have two __ready queues. That's why I need to use only one of then. If the user want to initialize a FCFS Scheduler, I use the one with no priority, and if the user want a priority Scheduler, I use the priority_queue. This is controlled by a BOOOS's static enum member. So, here's my question: Can I use something similar to if in this part of the code to choose only one queue instead of creating two and make an if everytime I need to manipulate it in my program?
Aucun commentaire:
Enregistrer un commentaire