From 980d9b410a93d5b97b91083e288067e0700f3465 Mon Sep 17 00:00:00 2001 From: tchernobog Date: Mon, 28 Aug 2006 22:29:56 +0000 Subject: [PATCH] - Fix a minor bug in scheduler that didn't ended the simulation if there was a 'hole' between threads of the same process. The fix isn't the most elegant thing in the universe, but it's simple and it'll do. git-svn-id: svn://svn.gna.org/svn/sgpemv2/trunk@957 3ecf2c5c-341e-0410-92b4-d18e462d057c --- src/backend/scheduler.cc | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/backend/scheduler.cc b/src/backend/scheduler.cc index 639ec30..18c55ba 100644 --- a/src/backend/scheduler.cc +++ b/src/backend/scheduler.cc @@ -446,9 +446,13 @@ Scheduler::step_forward(History& history, CPUPolicy& cpu_policy) // 3. check for simulation termination (we can directly use threads // for this check, since processes' state is based upon threads' one) - if ((current.get_state() & (Schedulable::state_blocked | Schedulable::state_terminated)) == 0) - alive_threads++; - + Schedulable::state cur_state = current.get_state(); + if ((cur_state & (Schedulable::state_blocked | Schedulable::state_terminated)) == 0 && + (current.get_process().get_state() != Schedulable::state_terminated)) // check for holes + { + alive_threads++; + } + } //~ for over all_threads // ?. Time to see if some unallocable request became allocable, so