qpc/doxygen/snippets/qf_subscribe.c
Quantum Leaps cd6736f1fd 5.4.0
2015-04-28 13:45:35 -04:00

14 lines
511 B
C

QState Table_initial(Table * const me, QEvt const * 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);
}