1 // Asynchronous communicator
10 #include "msg_thread.h"
17 // Send a message to the "dest" mailbox
18 void send(const char* dest, message* msg);
20 // Try to flush pending sending communications.
21 // If "wait" is true, blocks until success.
22 void flush(bool wait);
24 // Try to get a message. Returns true on success.
25 // Parameter "timeout" may be 0 for non-blocking operation, -1 for
26 // infinite waiting, or any positive timeout.
27 bool recv(message*& msg, m_host_t& from, double timeout);
33 // List of pending send communications
34 typedef std::vector<msg_comm_t> sent_comm_type;
35 sent_comm_type sent_comm;
37 // Queue of received messages
38 message_queue received;
40 // Handling of receiving thread
41 msg_thread* receiver_thread;
44 // Used to chek if a communication is successfull before destroying it
45 static void comm_check_n_destroy(msg_comm_t comm);
46 // If comm is over, call comm_check_n_destroy(comm), and return true
47 static bool comm_test_n_destroy(msg_comm_t comm);
50 #endif // !COMMUNICATOR_H