- removed Scheduler-initiated events

git-svn-id: svn://svn.gna.org/svn/sgpemv2/trunk@604 3ecf2c5c-341e-0410-92b4-d18e462d057c
This commit is contained in:
elvez 2006-06-03 15:51:38 +00:00
parent 8062dd95da
commit da39407173
15 changed files with 21 additions and 55 deletions

View file

@ -60,9 +60,8 @@ namespace sgpem
Because it's a pure virtual method, must be re-implemented
in concrete derived classes.
\param event Call reason. Needed only by some scheduling policies.
*/
virtual void sort_queue(Scheduler::event event) const throw(UserInterruptException) = 0;
virtual void sort_queue() const throw(UserInterruptException) = 0;
/**
Gets the unique identifier (id) of this Policy.
@ -81,9 +80,6 @@ namespace sgpem
/**
Tell if this policy is preemptible.
If true, for the \ref Scheduler::SCHEDULABLE_ARRIVAL event, the
ready queue will contain also the running \ref Schedulable;
else the running Schedulable will not be in the queue.
Because it's a pure virtual method, must be re-implemented
in concrete derived classes.

View file

@ -126,7 +126,7 @@ Scheduler::step_forward() throw(UserInterruptException)
initial->get_item_at(i)->set_state(SchedulableStatus::state_ready);
// Sort the queue
policy.sort_queue(event_schedulable_arrival);
policy.sort_queue();
//restore the old running schedulable
if (policy.is_pre_emptive() == false && running_ptr)
@ -153,14 +153,14 @@ Scheduler::step_forward() throw(UserInterruptException)
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();
}
//*****************
// Check for time slice
//*****************
if (policy.get_time_slice() != numeric_limits<int>::max()) //time-slice
policy.sort_queue(event_end_time_slice);
policy.sort_queue();
//******************
// Create the final list of schedulable

View file

@ -55,25 +55,6 @@ namespace sgpem
class SG_DLLEXPORT Scheduler
{
public:
/** The events that may cause the need for updating the scheduling queue
and/or the running process.
*/
enum event
{
/**
The arrival of a newly-created process.
*/
event_schedulable_arrival,
/**
The termination of the executing process.
*/
event_schedulable_termination,
/**
The end of the executing process' time quantum.
*/
event_end_time_slice
};
/** \brief Returns the unique instance of this class, conforming to the Singleton pattern.
*
* If Scheduler isn't initialized, creates it. Should be called at least once before

View file

@ -80,7 +80,7 @@ namespace sgpem
{
}
virtual void sort_queue(Scheduler::event event) const throw(UserInterruptException)
virtual void sort_queue() const throw(UserInterruptException)
{ // here a lot of fun, exactly O(n^2) fun!
SchedulableQueue sl = History.get_instance().get_simulation_status_at(get_current_time());
for (int i = 0; i < sl.size(); i++)