예제 #1
0
 virtual void handle_message(const message& m)
 {
     switch (m.what())
     {
         case EAT:
             eat();
             break;
         default:
             estd_assert(false);
             break;
     }
 }
예제 #2
0
 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;
     }
 }
예제 #3
0
inline void report( std::ostream & os, message const & e, std::string test )
{
    os << e.where << ": " << e.kind << e.note << ": " << test << ": " << e.what() << std::endl;
}