qpc/doxygen/snippets/qf_state.c
Quantum Leaps 0e95d49224 5.1.0
2013-09-23 14:34:35 -04:00

21 lines
600 B
C

QState Philo_eating(Philo * const me, QEvt const * const e) {
TableEvt *pe;
switch (e->sig) {
case Q_ENTRY_SIG: {
QTimeEvt_armX(&me->timeEvt, EAT_TIME, 0U); /* one shot */
return Q_HANDLED();
}
case Q_EXIT_SIG: {
QTimeEvt_disarm(&me->timeEvt);
pe = Q_NEW(TableEvt, DONE_SIG);
pe->philNum = me->num;
QF_PUBLISH((QEvt *)pe, me);
return Q_HANDLED();
}
case TIMEOUT_SIG: {
return Q_TRAN(&Philosopher_thinking);
}
}
return Q_SUPER(&QHsm_top);
}