|
QP/C
|
QActive_subscribe() definition. More...
Go to the source code of this file.
Functions | |
| void | QActive_subscribe (QActive const *me, QSignal sig) |
| Subscribes for delivery of signal sig to the active object me. | |
QActive_subscribe() definition.
Definition in file qa_sub.c.
| void QActive_subscribe | ( | QActive const * | me, |
| QSignal | sig | ||
| ) |
Subscribes for delivery of signal sig to the active object me.
This function is part of the Publish-Subscribe event delivery mechanism available in QF. Subscribing to an event means that the framework will start posting all published events with a given signal sig to the event queue of the active object me.
The following example shows how the Table active object subscribes to three signals in the initial transition:
QState Table_initial(Table *me, QEvent const *e) { uint8_t n; (void)e; /* suppress the compiler warning */ QActive_subscribe((QActive *)me, HUNGRY_SIG); /* subscribe to HUNGRY */ QActive_subscribe((QActive *)me, DONE_SIG); /*... to DONE */ QActive_subscribe((QActive *)me, TERMINATE_SIG); /*...and to TERMINATE */ for (n = 0; n < N; ++n) { me->fork[n] = FREE; me->isHungry[n] = 0; } return Q_TRAN(&Table_serving); }
Definition at line 40 of file qa_sub.c.
References Q_REQUIRE, Q_USER_SIG, QF_active_, QF_div8Lkup, QF_MAX_ACTIVE, QF_maxSignal_, QF_PTR_AT_, QF_pwr2Lkup, QF_subscrList_, QS_aoObj_, QS_BEGIN_NOCRIT_, QS_END_NOCRIT_, QS_OBJ_, QS_QF_ACTIVE_SUBSCRIBE, and QS_TIME_.
1.7.6.1