virtual void handle_message(const message& m) { switch (m.what()) { case EAT: eat(); break; default: estd_assert(false); break; } }
virtual void handle_message(const message& m) { uint32_t id = *reinterpret_cast<uint32_t*>(m.obj()); switch (m.what()) { case FINISHED_EATING: --eating_; states_[id]->set_state(PhilospherState::THINKING); try_to_eat(); break; case WANT_TO_EAT: states_[id]->set_state(PhilospherState::READY); try_to_eat(); break; default: estd_assert(false); break; } }
inline void report( std::ostream & os, message const & e, std::string test ) { os << e.where << ": " << e.kind << e.note << ": " << test << ": " << e.what() << std::endl; }