Example #1
0
bool EventableResource::checkEvent()
{
    if (eventsPermitted() && seeEventEnable(owner->time)) {
        event(owner->time);
        return true;
    }
    return false;
}
Example #2
0
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);
}
Example #3
0
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;
}
Example #4
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);
    }
}
Example #5
0
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);
    }
}