QP/C
Data Fields
QTimeEvt Struct Reference

Time Event structure. More...

#include <qf.h>

Data Fields

QEvt super
struct QTimeEvtTag * next
QActiveact
QTimeEvtCtr ctr
QTimeEvtCtr interval

Detailed Description

Time Event structure.

Time events are special QF events equipped with the notion of time passage. The basic usage model of the time events is as follows. An active object allocates one or more QTimeEvt objects (provides the storage for them). When the active object needs to arrange for a timeout, it arms one of its time events to fire either just once (one-shot) or periodically. Each time event times out independently from the others, so a QF application can make multiple parallel timeout requests (from the same or different active objects). When QF detects that the appropriate moment has arrived, it inserts the time event directly into the recipient's event queue. The recipient then processes the time event just like any other event.

Time events, as any other QF events derive from the QEvt base structure. Typically, you will use a time event as-is, but you can also further derive more specialized time events from it by adding some more data members and/or specialized functions that operate on the specialized time events.

Internally, the armed time events are organized into a bi-directional linked list. This linked list is scanned in every invocation of the QF_tick() function. Only armed (timing out) time events are in the list, so only armed time events consume CPU cycles.

See also:
::QTimeEvtTag for the description of the data members
Encapsulation and Single Inheritance in C
Note:
QF manages the time events in the function QF_tick(), which must be called periodically, preferably from the clock tick ISR.
In this version of QF QTimeEvt objects should be allocated statically rather than dynamically from event pools. Currently, QF will not correctly recycle the dynamically allocated Time Events.

Definition at line 495 of file qf.h.


Field Documentation

the active object that receives the time events.

Definition at line 507 of file qf.h.

Referenced by QF_tick(), QTimeEvt_ctr(), and QTimeEvt_disarm().

QTimeEvtCtr QTimeEvt::ctr

the internal down-counter of the time event. The down-counter is decremented by 1 in every QF_tick() invocation. The time event fires (gets posted or published) when the down-counter reaches zero.

Definition at line 513 of file qf.h.

Referenced by QF_tick(), QTimeEvt_ctr(), and QTimeEvt_disarm().

QTimeEvtCtr QTimeEvt::interval

the interval for the periodic time event (zero for the one-shot time event). The value of the interval is re-loaded to the internal down-counter when the time event expires, so that the time event keeps timing out periodically.

Definition at line 520 of file qf.h.

Referenced by QF_tick(), QTimeEvt_ctr(), and QTimeEvt_disarm().

struct QTimeEvtTag* QTimeEvt::next

link to the next time event in the list

Definition at line 503 of file qf.h.

Referenced by QF_tick().

base structure from which QTimeEvt derives

See also:
QEvt
Encapsulation and Single Inheritance in C

Definition at line 499 of file qf.h.

Referenced by QF_tick().


The documentation for this struct was generated from the following file: