5 std::string message::to_string()
7 static const char* str[] = { "INFO", "CREDIT", "LOAD",
8 "CTRL_CLOSE", "DATA_CLOSE" };
9 std::ostringstream oss;
10 oss << str[type] << ": " << amount;
14 void message_queue::push(m_task_t task)
22 bool message_queue::pop(message*& msg, m_host_t& from, double timeout)
25 volatile double deadline =
26 timeout > 0 ? MSG_get_clock() + timeout : 0.0;
28 while (queue.empty() && (!deadline || deadline > MSG_get_clock())) {
32 cond.timedwait(mutex, deadline - MSG_get_clock());
37 if (e.category != timeout_error)
48 m_task_t task = queue.front();
50 msg = static_cast<message*>(MSG_task_get_data(task));
51 from = MSG_task_get_source(task);
52 MSG_task_destroy(task);