mirror of
https://github.com/QuantumLeaps/qpcpp.git
synced 2025-01-28 06:02:56 +08:00
18 lines
469 B
C++
18 lines
469 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() // constructor
|
|
: QActive(&initial), // superclass' constructor
|
|
m_timeEvt(TIMEOUT_SIG, this, 0U)
|
|
{}
|
|
|
|
protected:
|
|
Q_STATE_DECL(initial);
|
|
Q_STATE_DECL(thinking);
|
|
Q_STATE_DECL(hungry);
|
|
Q_STATE_DECL(eating);
|
|
};
|