4 XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(comm);
10 std::string message::to_string()
12 static const char* str[] = { "INFO", "CREDIT", "LOAD",
13 "CTRL_CLOSE", "DATA_CLOSE" };
14 std::ostringstream oss;
15 oss << str[type] << ": " << amount;
19 void message_queue::push(m_task_t task)
27 bool message_queue::pop(message*& msg, m_host_t& from, double timeout)
30 volatile double deadline =
31 timeout > 0 ? MSG_get_clock() + timeout : 0.0;
33 while (queue.empty() && (!deadline || deadline > MSG_get_clock())) {
35 XBT_DEBUG("waiting for a message to come");
38 cond.timedwait(mutex, deadline - MSG_get_clock());
43 if (e.category != timeout_error)
54 m_task_t task = queue.front();
56 msg = static_cast<message*>(MSG_task_get_data(task));
57 from = MSG_task_get_source(task);
58 MSG_task_destroy(task);
60 XBT_DEBUG("received %s from %s",
61 msg->to_string().c_str(), MSG_host_get_name(from));