summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/systemc/core/scheduler.cc9
-rw-r--r--src/systemc/core/scheduler.hh1
2 files changed, 9 insertions, 1 deletions
diff --git a/src/systemc/core/scheduler.cc b/src/systemc/core/scheduler.cc
index eda4ed7e4..cf34fe8b7 100644
--- a/src/systemc/core/scheduler.cc
+++ b/src/systemc/core/scheduler.cc
@@ -44,7 +44,7 @@ Scheduler::Scheduler() :
stopEvent(this, false, StopPriority),
scMain(nullptr),
starvationEvent(this, false, StarvationPriority),
- _started(false), _paused(false), _stopped(false),
+ _started(false), _paused(false), _stopped(false), _stopNow(false),
maxTickEvent(this, false, MaxTickPriority),
_numCycles(0), _changeStamp(0), _current(nullptr), initDone(false),
runOnce(false)
@@ -189,6 +189,9 @@ Scheduler::yield()
void
Scheduler::ready(Process *p)
{
+ if (_stopNow)
+ return;
+
// Clump methods together to minimize context switching.
static bool cluster_methods = false;
@@ -277,6 +280,9 @@ Scheduler::runReady()
_changeStamp++;
}
+ if (_stopNow)
+ return;
+
// The update phase.
update();
@@ -383,6 +389,7 @@ Scheduler::scheduleStop(bool finish_delta)
return;
if (!finish_delta) {
+ _stopNow = true;
// If we're not supposed to finish the delta cycle, flush all
// pending activity.
clear();
diff --git a/src/systemc/core/scheduler.hh b/src/systemc/core/scheduler.hh
index 924cfb29e..f0cbac43c 100644
--- a/src/systemc/core/scheduler.hh
+++ b/src/systemc/core/scheduler.hh
@@ -386,6 +386,7 @@ class Scheduler
bool _started;
bool _paused;
bool _stopped;
+ bool _stopNow;
Tick maxTick;
Tick lastReadyTick;