+2008-06-17 Dave Brolley <brolley@redhat.com>
+
+ * compSched.cxx (deliver_regular): Drive rnext->when.
+ (deliver_irregular): Drive irnext->when.
+ (advancy_any): Check yield_step_loop_p.
+ (cancel_all): New method of generic_scheduler.
+ (time_set_pin): New member of scheduler_component.
+ (scheduler_component::set_time): Call set_now with 'then - 1'.
+ Call sched.cancel_all. Drive time_set_pin.
+ (scheduler_component_ctor_1): Add time-set pin.
+
2005-12-16 Nathan Sidwell <nathan@codesourcery.com>
Second part of ms1 to mt renaming.
// compSched.cxx - the scheduler component. -*- C++ -*-
-// Copyright (C) 1999-2003, 2005 Red Hat.
+// Copyright (C) 1999-2003, 2005, 2006 Red Hat.
// This file is part of SID and is licensed under the GPL.
// See the file COPYING.SID for conditions for redistribution.
#include "config.h"
this->refill_regular_events_table();
// deliver event
assert (victim);
- victim->drive (0);
+ victim->drive (rnext->when);
}
this->irregular_events.pop_back();
// deliver event
assert (victim);
- victim->drive (0);
+ victim->drive (irnext->when);
}
evpair = this->next_event ();
} while ((evpair.first != 0) // still an event
&& (evpair.first->when <= now) // still due
- && (due_count < due_limit)); // not too many iterations
+ && (due_count < due_limit) // not too many iterations
+ && ! this->yield_step_loop_p);
// cout << "sid-sched: delivered " << due_count << " due/overdue events." << endl;
}
+ // Cancel all pending events.
+ void
+ cancel_all ()
+ {
+ this->irregular_events.clear ();
+ this->regular_table_iter = this->regular_events_table.end();
+ this->yield_step_loop_p = true;
+ }
+
// Add a pin<->string mapping
void
clear_pin_mappings ()
output_pin time_low_pin;
output_pin time_high_pin;
output_pin active_pin;
+ output_pin time_set_pin;
public:
tick_t then;
component::status s = parse_attribute(t, then);
if (UNLIKELY(s != component::ok)) return s;
- this->sched.set_now (then);
+ this->sched.set_now (then - 1);
tick_t now;
this->sched.get_now (now);
- if (then != now)
+ if (then - 1 != now)
return component::bad_value;
- else
- return component::ok;
+ this->sched.cancel_all ();
+ time_set_pin.drive (then);
+ return component::ok;
}
protected:
add_pin ("time-low", & this->time_low_pin);
add_pin ("yield", & this->yield_pin);
add_pin ("active", & this->active_pin);
+ add_pin ("time-set", & this->time_set_pin);
add_attribute ("yield", & this->yield_pin, "pin");
add_attribute ("enable-threshold", & this->enable_threshold, "setting");
add_attribute ("enabled?", & this->enable_p, "setting");