qpcpp/doxygen/snippets/qf_qactive.cpp

18 lines
475 B
C++
Raw Normal View History

class Philo : public QP::QActive { // inherits QP::QActive
2012-08-14 18:00:48 -04:00
private:
2013-10-10 20:01:51 -04:00
uint8_t m_num; // number of this philosopher
QTimeEvt m_timeEvt; // to timeout thining or eating
2012-08-14 18:00:48 -04:00
public:
2019-03-28 11:59:31 -04:00
Philo::Philo() // constructor
: QActive(&initial), // superclass' constructor
m_timeEvt(TIMEOUT_SIG, this, 0U)
2012-08-14 18:00:48 -04:00
{}
protected:
2019-03-28 11:59:31 -04:00
Q_STATE_DECL(initial);
Q_STATE_DECL(thinking);
Q_STATE_DECL(hungry);
Q_STATE_DECL(eating);
2012-08-14 18:00:48 -04:00
};