diff --git a/src/systemc/core/scheduler.cc b/src/systemc/core/scheduler.cc index 50a1e6bd34..cc0be7cd4c 100644 --- a/src/systemc/core/scheduler.cc +++ b/src/systemc/core/scheduler.cc @@ -259,6 +259,7 @@ Scheduler::asyncRequestUpdate(Channel *c) { std::lock_guard lock(asyncListMutex); asyncUpdateList.pushLast(c); + hasAsyncUpdate = true; } void @@ -325,11 +326,12 @@ void Scheduler::runUpdate() { status(StatusUpdate); - { + if (hasAsyncUpdate) { std::lock_guard lock(asyncListMutex); Channel *channel; while ((channel = asyncUpdateList.getNext()) != nullptr) updateList.pushLast(channel); + hasAsyncUpdate = false; } try { diff --git a/src/systemc/core/scheduler.hh b/src/systemc/core/scheduler.hh index 742f916382..13f35ed5f5 100644 --- a/src/systemc/core/scheduler.hh +++ b/src/systemc/core/scheduler.hh @@ -28,6 +28,7 @@ #ifndef __SYSTEMC_CORE_SCHEDULER_HH__ #define __SYSTEMC_CORE_SCHEDULER_HH__ +#include #include #include #include @@ -529,6 +530,7 @@ class Scheduler ChannelList asyncUpdateList; std::mutex asyncListMutex; + std::atomic hasAsyncUpdate; std::map<::Event *, Tick> eventsToSchedule;