43,121d42
< SensitivityTimeout::SensitivityTimeout(Process *p, ::sc_core::sc_time t) :
< Sensitivity(p), timeoutEvent([this]() { this->timeout(); })
< {
< scheduler.schedule(&timeoutEvent, t);
< }
<
< SensitivityTimeout::~SensitivityTimeout()
< {
< if (timeoutEvent.scheduled())
< scheduler.deschedule(&timeoutEvent);
< }
<
< void
< SensitivityTimeout::timeout()
< {
< notify();
< }
<
< SensitivityEvent::SensitivityEvent(
< Process *p, const ::sc_core::sc_event *e) : Sensitivity(p), event(e)
< {
< Event::getFromScEvent(event)->addSensitivity(this);
< }
<
< SensitivityEvent::~SensitivityEvent()
< {
< Event::getFromScEvent(event)->delSensitivity(this);
< }
<
< SensitivityEventAndList::SensitivityEventAndList(
< Process *p, const ::sc_core::sc_event_and_list *list) :
< Sensitivity(p), list(list), count(0)
< {
< for (auto e: list->events)
< Event::getFromScEvent(e)->addSensitivity(this);
< }
<
< SensitivityEventAndList::~SensitivityEventAndList()
< {
< for (auto e: list->events)
< Event::getFromScEvent(e)->delSensitivity(this);
< }
<
< void
< SensitivityEventAndList::notifyWork(Event *e)
< {
< e->delSensitivity(this);
< count++;
< if (count == list->events.size())
< satisfy();
< }
<
< SensitivityEventOrList::SensitivityEventOrList(
< Process *p, const ::sc_core::sc_event_or_list *list) :
< Sensitivity(p), list(list)
< {
< for (auto e: list->events)
< Event::getFromScEvent(e)->addSensitivity(this);
< }
<
< SensitivityEventOrList::~SensitivityEventOrList()
< {
< for (auto e: list->events)
< Event::getFromScEvent(e)->delSensitivity(this);
< }
<
< void
< SensitivityTimeoutAndEventAndList::notifyWork(Event *e)
< {
< if (e) {
< // An event went off which must be part of the sc_event_and_list.
< SensitivityEventAndList::notifyWork(e);
< } else {
< // There's no inciting event, so this must be a timeout.
< satisfy(true);
< }
< }
<
<
198c119
< dynamic_cast<SensitivityTimeout *>(dynamicSensitivity)) {
---
> timeoutEvent.scheduled()) {
320,325c241,242
< for (auto &s: pendingStaticSensitivities) {
< s->finalize(staticSensitivities);
< delete s;
< s = nullptr;
< }
< pendingStaticSensitivities.clear();
---
> for (auto s: staticSensitivities)
> s->finalize();
349c266
< Process::addStatic(PendingSensitivity *s)
---
> Process::addStatic(StaticSensitivity *s)
351c268
< pendingStaticSensitivities.push_back(s);
---
> staticSensitivities.push_back(s);
355c272
< Process::setDynamic(Sensitivity *s)
---
> Process::setDynamic(DynamicSensitivity *s)
357c274,277
< delete dynamicSensitivity;
---
> if (dynamicSensitivity) {
> dynamicSensitivity->clear();
> delete dynamicSensitivity;
> }
358a279,280
> if (dynamicSensitivity)
> dynamicSensitivity->finalize();
361a284,311
> Process::cancelTimeout()
> {
> if (timeoutEvent.scheduled())
> scheduler.deschedule(&timeoutEvent);
> }
>
> void
> Process::setTimeout(::sc_core::sc_time t)
> {
> cancelTimeout();
> scheduler.schedule(&timeoutEvent, t);
> }
>
> void
> Process::timeout()
> {
> // A process is considered timed_out only if it was also waiting for an
> // event but got a timeout instead.
> _timedOut = (dynamicSensitivity != nullptr);
>
> setDynamic(nullptr);
> if (disabled())
> return;
>
> ready();
> }
>
> void
365c315,316
< if (dynamicSensitivity && dynamicSensitivity != s)
---
> if ((dynamicSensitivity || timeoutEvent.scheduled()) &&
> dynamicSensitivity != s) {
366a318
> }
368c320,325
< setDynamic(nullptr);
---
> _timedOut = false;
> // This sensitivity should already be cleared by this point, or the event
> // which triggered it will take care of it.
> delete dynamicSensitivity;
> dynamicSensitivity = nullptr;
> cancelTimeout();
397,398c354,356
< ::sc_core::sc_process_b(name), excWrapper(nullptr), func(func),
< _internal(internal), _timedOut(false), _dontInitialize(false),
---
> ::sc_core::sc_process_b(name), excWrapper(nullptr),
> timeoutEvent([this]() { this->timeout(); }),
> func(func), _internal(internal), _timedOut(false), _dontInitialize(false),
416,418c374,377
< delete dynamicSensitivity;
< dynamicSensitivity = nullptr;
< for (auto s: staticSensitivities)
---
> clearDynamic();
> cancelTimeout();
> for (auto s: staticSensitivities) {
> s->clear();
419a379
> }