- Fix compilation

git-svn-id: svn://svn.gna.org/svn/sgpemv2/trunk@712 3ecf2c5c-341e-0410-92b4-d18e462d057c
This commit is contained in:
tchernobog 2006-07-04 19:53:58 +00:00
parent 5ab575dffd
commit b7d61d5c56
2 changed files with 121 additions and 124 deletions

View File

@ -21,10 +21,7 @@
#include "concrete_environment.hh" #include "concrete_environment.hh"
#include "concrete_history.hh" #include "concrete_history.hh"
#include "policy.hh" #include "policy.hh"
#include "schedulable.hh"
#include "scheduler.hh" #include "scheduler.hh"
#include "policy_manager.hh"
#include "policies_gatekeeper.hh"
#include "user_interrupt_exception.hh" #include "user_interrupt_exception.hh"
// Do not include full template definition in the header file // Do not include full template definition in the header file
@ -59,21 +56,6 @@ collect_threads(const std::vector<Process*>& procs,
} }
} }
static void
free_all_resources_of(DynamicThread& ended_thread)
{
typedef std::vector<DynamicRequest*> Requests;
typedef std::vector<DynamicSubRequest*> SubRequests;
Requests& reqs = ended_thread.get_dynamic_requests();
for(Requests::iterator it = reqs.begin(); it != reqs.end(); it++)
{
// FIXME : write me
// Where is "state_fulfilled" or similar in Request::state?
}
}
// --------------------------------------------------------- // ---------------------------------------------------------
@ -81,16 +63,15 @@ free_all_resources_of(DynamicThread& ended_thread)
//private constructor. The parameter is discarded //private constructor. The parameter is discarded
Scheduler::Scheduler() Scheduler::Scheduler()
: _policy_manager(PolicyManager::get_registered_manager()) : _ready_queue(NULL), _policy(NULL)
{ {}
_policy_manager.init();
}
ReadyQueue* ReadyQueue*
Scheduler::get_ready_queue() Scheduler::get_ready_queue()
{ {
// FIXME return the correct queue accordingly to the value returned by Policy::wants() // FIXME return the correct queue accordingly to the value returned by Policy::wants()
return &_ready_queue; return _ready_queue;
} }
@ -192,7 +173,7 @@ Scheduler::step_forward(History& history, Policy& cpu_policy) throw(UserInterrup
if(running_thread->get_state() == Schedulable::state_terminated) if(running_thread->get_state() == Schedulable::state_terminated)
{ {
// for(Requests::iterator it = reqs.begin(); // for(Requests::iterator it = reqs.begin();
}
// FIXME we lack a way to tell and/or remember for how // FIXME we lack a way to tell and/or remember for how
// much a subrequest has been being fulfilled // much a subrequest has been being fulfilled
@ -205,7 +186,6 @@ Scheduler::step_forward(History& history, Policy& cpu_policy) throw(UserInterrup
// This is why we kept a ref to the old running thread, // This is why we kept a ref to the old running thread,
// even if it was terminated // even if it was terminated
free_all_resources_of(*running_thread); // this function isn't complete
} }
@ -225,6 +205,12 @@ Scheduler::step_forward(History& history, Policy& cpu_policy) throw(UserInterrup
prepare_ready_queue(ready_queue); prepare_ready_queue(ready_queue);
try try
{ {
// Temporarily set the _ready_queue param and the _policy one for
// use from external plugins
_policy = &cpu_policy;
_ready_queue = &new_snapshot->get_sorted_queue();
// ?. Use the policy to sort the queue // ?. Use the policy to sort the queue
// FIXME: how does it get the queue? // FIXME: how does it get the queue?
@ -232,7 +218,8 @@ Scheduler::step_forward(History& history, Policy& cpu_policy) throw(UserInterrup
} }
catch(UserInterruptException& e) catch(UserInterruptException& e)
{ {
_policy_manager.init(); _policy = NULL;
_ready_queue = NULL;
// ^^^^^ // ^^^^^
// Do we need to update something else? // Do we need to update something else?
@ -245,4 +232,14 @@ Scheduler::step_forward(History& history, Policy& cpu_policy) throw(UserInterrup
// append the new snapshot... // append the new snapshot...
// ...and remember to release the auto_ptr! // ...and remember to release the auto_ptr!
concrete_history.append_new_environment(new_snapshot.release()); concrete_history.append_new_environment(new_snapshot.release());
_policy = NULL;
_ready_queue = NULL;
}
void
Scheduler::prepare_ready_queue(ReadyQueue& queue)
{
} }

View File

@ -92,8 +92,8 @@ namespace sgpem
Scheduler(); //private constructor. Scheduler(); //private constructor.
ReadyQueue _ready_queue; ReadyQueue* _ready_queue;
PolicyManager& _policy_manager; Policy* _policy;
}; };
}//~ namespace sgpem }//~ namespace sgpem