7 #include "simgrid_features.h"
9 #include "sync_queue.h"
13 enum message_type { CTRL, DATA, CTRL_CLOSE, DATA_CLOSE };
15 message(message_type t, double a, double c = 0.0);
17 message_type get_type() const { return type; }
18 double get_amount() const { return amount; }
19 double get_credit() const { return credit; }
20 double get_size() const { return size; }
22 std::string to_string();
33 // Push a message on queue
34 void push(msg_task_t task);
36 // Try to pop a message. Returns true on success.
37 // Parameter "timeout" may be 0 for non-blocking operation, -1 for
38 // infinite waiting, or any positive timeout.
39 bool pop(message*& msg, msg_host_t& from, double timeout);
41 bool empty() const { return queue.empty(); }
42 size_t size() const { return queue.size(); }
47 sync_queue<msg_task_t> queue;