mirror of
https://github.com/QuantumLeaps/qpc.git
synced 2025-01-14 06:43:19 +08:00
14 lines
470 B
C
14 lines
470 B
C
QState Table_initial(Table * const me, QEvt const * const e) {
|
|
uint8_t n;
|
|
(void)e; /* suppress the compiler warning */
|
|
|
|
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 */
|
|
for (n = 0; n < N; ++n) {
|
|
me->fork[n] = FREE;
|
|
me->isHungry[n] = 0;
|
|
}
|
|
return Q_TRAN(&Table_serving);
|
|
}
|