bool EventableResource::checkEvent() { if (eventsPermitted() && seeEventEnable(owner->time)) { event(owner->time); return true; } return false; }
void EventableResource::event(ticks_t time) { assert(eventsPermitted()); SystemState &sys = *owner->getParent().getParent()->getParent(); if (owner->isExecuting()) { sys.setPendingEvent(*this, time, interruptMode); return; } owner->time = time; sys.takeEvent(*owner, *this, interruptMode); }
void Chanend::update(ticks_t time) { assert(!buf.empty()); if (eventsPermitted()) { event(time); return; } if (!pausedIn) return; if (waitForWord && buf.size() < 4) return; pausedIn->time = time; pausedIn->schedule(); pausedIn = 0; }
void EventableResource::eventEnable(Thread &thread) { updateOwner(thread); if (!eventsEnabled) { if (interruptMode) { owner->addInterruptEnabledResource(this); } else { owner->addEventEnabledResource(this); } } eventsEnabled = true; if (eventsPermitted() && seeEventEnable(owner->time)) { event(owner->time); } }
void EventableResource::setInterruptMode(Thread &thread, bool Enable) { updateOwner(thread); if (Enable == interruptMode) return; if (eventsEnabled) { if (interruptMode) { owner->removeInterruptEnabledResource(this); owner->addEventEnabledResource(this); } else { owner->removeEventEnabledResource(this); owner->addInterruptEnabledResource(this); } } interruptMode = Enable; if (eventsPermitted() && seeEventEnable(thread.time)) { event(thread.time); } }