QP/C
Functions
qte_ctor.c File Reference

QTimeEvt_ctor() implementation. More...

#include "qf_pkg.h"
#include "qassert.h"

Go to the source code of this file.

Functions

void QTimeEvt_ctor (QTimeEvt *me, QSignal sig)
 The "constructor" to initialize a Time Event.

Detailed Description

QTimeEvt_ctor() implementation.

Definition in file qte_ctor.c.


Function Documentation

void QTimeEvt_ctor ( QTimeEvt me,
QSignal  sig 
)

The "constructor" to initialize a Time Event.

You should call this function exactly once for every Time Event object BEFORE arming the Time Event. The most important action performed in this function is assigning a signal to the Time Event. You can reuse the Time Event any number of times, but you should not change the signal. This is because pointers to Time Events might still be held in event queues and changing signal could to hard-to-detect errors.

The following example shows the invocation of QTimeEvt_ctor() from the "constructor" of the Philosopher active object that owns the time event

void Philosopher_ctor(Philosopher *me) {
    QActive_ctor(&me->super, (QStateHandler)&Philosopher_initial);
    QTimeEvt_ctor(&me->timeEvt, TIMEOUT_SIG);
}

Definition at line 40 of file qte_ctor.c.

References Q_REQUIRE, Q_USER_SIG, and QF_EVT_POOL_ID_.