- Make libpyloader a loadable plugin (warning: won't work

on Window$ unless you change the string "libpyloader" to
"pyloader" into main.cc)
- Fix Makefile to support module creation and loading
- 2DO: 
	- Add a class into backend to load and manage plugins
	- Install plugins into separate directory
	- Remove hardcoded paths


git-svn-id: svn://svn.gna.org/svn/sgpemv2/trunk@458 3ecf2c5c-341e-0410-92b4-d18e462d057c
This commit is contained in:
tchernobog 2006-02-25 12:21:30 +00:00
parent 38f7b84909
commit 56534edb6c
15 changed files with 187 additions and 215 deletions

View file

@ -20,29 +20,33 @@
#include "policy.hh"
#include "scheduler.hh"
#include "policy_manager.hh"
using namespace std;
using namespace sgpem;
using namespace memory;
//static object
Scheduler Scheduler::_instance(10); //dummy parameter
Scheduler*
Scheduler::_instance = 0;
/**
*/
Scheduler::Scheduler(int) //private constructor. The parameter is discarded
{}
//private constructor. The parameter is discarded
Scheduler::Scheduler()
: _policy_manager(PolicyManager::get_registered_manager())
{
_policy_manager.init();
}
Scheduler&
Scheduler::get_instance()
{
return _instance;
if(!_instance)
_instance = new Scheduler();
return *_instance;
}
SchedulableList*
Scheduler::get_ready_queue()
{
return &_ready_queue;
return &_ready_queue;
}
@ -58,23 +62,24 @@ Scheduler::reset_status()
// restore the policy
}
void
/* void
Scheduler::set_policy(Policy* p)
{
_policy = p;
}
_policy_manager.set_policy(p);
}*/
Policy*
Policy&
Scheduler::get_policy()
{
return _policy;
return _policy_manager.get_policy();
}
void
Scheduler::step_forward()
{
Policy& policy = get_policy();
History& h = History::get_instance();
//******************
@ -107,7 +112,7 @@ Scheduler::step_forward()
//cout << "\nnuovo running: " << initial->get_item_at(i)->get_schedulable()->get_name();
//restore the old running schedulable
if (_policy->is_pre_emptive() == false && running_ptr)
if (policy.is_pre_emptive() == false && running_ptr)
_ready_queue.remove(0);
//adds the NEW one
@ -116,10 +121,10 @@ Scheduler::step_forward()
initial->get_item_at(i)->set_state(SchedulableStatus::state_ready);
// Sort the queue
_policy->sort_queue(event_schedulable_arrival);
policy.sort_queue(event_schedulable_arrival);
//restore the old running schedulable
if (_policy->is_pre_emptive() == false && running_ptr)
if (policy.is_pre_emptive() == false && running_ptr)
_ready_queue.add_at_top(*running_ptr);
}
@ -143,14 +148,14 @@ Scheduler::step_forward()
running_ptr = NULL;
//IF _ready_queue.size() == 0 sort_queue(...) is called but has no effect!!
_policy->sort_queue(event_schedulable_termination);
policy.sort_queue(event_schedulable_termination);
}
//*****************
// Check for time slice
//*****************
if (_policy->get_time_slice() != numeric_limits<int>::max()) //time-slice
_policy->sort_queue(event_end_time_slice);
if (policy.get_time_slice() != numeric_limits<int>::max()) //time-slice
policy.sort_queue(event_end_time_slice);
//******************
// Create the final list of schedulable