qpcpp/doxygen/snippets/qf_qactive.cpp
Quantum Leaps 890c8e7d8c 5.1.1
2013-10-10 20:01:51 -04:00

18 lines
567 B
C++

class Philo : public QActive { // derives from QActive
private:
uint8_t m_num; // number of this philosopher
QTimeEvt m_timeEvt; // to timeout thining or eating
public:
Philo::Philo()
: QActive(Q_STATE_CAST(&Philo::initial)),
m_timeEvt(TIMEOUT_SIG, this, 0U)
{}
protected:
static QState initial (Philo * const me, QEvt const *e);
static QState thinking(Philo * const me, QEvt const *e);
static QState hungry (Philo * const me, QEvt const *e);
static QState eating (Philo * const me, QEvt const *e);
};