qpc/doxygen/snippets/qf_subscribe.c

14 lines
470 B
C
Raw Normal View History

2013-09-23 14:34:35 -04:00
QState Table_initial(Table * const me, QEvt const * const e) {
2012-08-14 18:07:04 -04:00
uint8_t n;
2015-12-24 14:33:20 -05:00
(void)e; /* suppress the compiler warning */
2012-08-14 18:07:04 -04:00
2015-12-24 14:33:20 -05:00
QActive_subscribe(&me->super, HUNGRY_SIG); /* subscribe to HUNGRY */
QActive_subscribe(&me->super, DONE_SIG); /*... to DONE */
QActive_subscribe(&me->super, TERMINATE_SIG); /*...and to TERMINATE */
2012-08-14 18:07:04 -04:00
for (n = 0; n < N; ++n) {
me->fork[n] = FREE;
me->isHungry[n] = 0;
}
return Q_TRAN(&Table_serving);
}