fixed a bug involving scheduler keeping a running thread in the ready queue

when that thread had just been given the cpu.
fixed a bug involving text-simulation displaying the wrong timestamp for
each snaphot. Now the first snapshot printed is correctly tagged "-1".

added (for the sake of lazyness) a method to readyqueue letting anyone
delete the first element on the queue. Not having this would imply
rebuilding the whole queue each time a thread was selected to run.

Small commits avoid complex mergings.


git-svn-id: svn://svn.gna.org/svn/sgpemv2/trunk@814 3ecf2c5c-341e-0410-92b4-d18e462d057c
This commit is contained in:
matrevis 2006-08-02 23:12:32 +00:00
parent 01490e24ac
commit 56a7ce1221
4 changed files with 21 additions and 2 deletions

View file

@ -1417,8 +1417,16 @@ TextSimulation::update(const History& changed_history)
{
ostringstream oss;
oss << ">>>> " << changed_history.get_size() - 1 << _("\nREADY QUEUE: { ");
/// since the history stores snapshots starting from
/// and including instant -1, the first snapshot on
/// the queue, i.e. changed_history[0] is actually
/// the snapshot corresponding to instant -1.
/// therefore, the last snapshot on the history refers
/// to instant (history.get_size() - 2).
// this is a damn uint, so we must hack and hack
int printed_instant = changed_history.get_size() > 1 ? changed_history.get_size() - 2 : -1;
oss << ">>>> " << printed_instant << _("\nREADY QUEUE: { ");
p_stdout(oss.str());
oss.str(string());