11 enum message_type { INFO, CREDIT, LOAD, CTRL_CLOSE, DATA_CLOSE };
13 message(message_type t, double a): type(t), amount(a) { }
15 message_type get_type() const { return type; }
16 double get_amount() const { return amount; }
18 std::string to_string();
27 // Push a message on queue
28 void push(m_task_t task);
30 // Try to get a message. Returns true on success.
31 // Parameter "timeout" may be 0 for non-blocking operation, -1 for
32 // infinite waiting, or any positive timeout.
33 bool pop(message*& msg, m_host_t& from, double timeout);
35 bool empty() const { return queue.empty(); }
36 size_t size() const { return queue.size(); }
41 std::queue<m_task_t> queue;