1 // Asynchronous communicator
13 enum message_type { INFO, CREDIT, LOAD, CTRL_CLOSE, DATA_CLOSE };
15 message(message_type t, double a): type(t), amount(a) { }
17 message_type get_type() const { return type; }
18 double get_amount() const { return amount; }
20 std::string to_string();
34 void send(const char* dest, message* msg);
35 bool recv(message*& msg, m_host_t& from, bool wait);
36 void flush(bool wait);
38 void next_close_on_ctrl_is_last();
39 void next_close_on_data_is_last();
45 // List of pending send communications
46 std::list<msg_comm_t> sent_comm;
48 // Control channel for receiving
51 bool ctrl_close_is_last;
53 // Data channel for receiving
56 bool data_close_is_last;
58 const char* get_ctrl_mbox() const { return host->get_ctrl_mbox(); }
59 const char* get_data_mbox() const { return host->get_data_mbox(); }
61 static void comm_push_in_dynar(xbt_dynar_t dynar, msg_comm_t comm);
62 static bool comm_test_n_destroy(msg_comm_t comm);
65 #endif // !COMMUNICATOR_H