* compute load balancing;
* send tasks to neighbors;
* }
+ * finalize;
+ * wait for pending messages;
*/
/* Open Questions :
void process::receive()
{
- bool received;
- do {
- double amount;
- m_host_t from;
- received = false;
- if (comm.recv_info(amount, from)) {
+ message* msg;
+ m_host_t from;
+ while (comm.recv(msg, from)) {
+ switch (msg->get_type()) {
+ case message::INFO:
// fixme: update neighbor
- received = true;
+ break;
+ case message::CREDIT:
+ expected_load += msg->get_amount();
+ break;
+ case message::LOAD:
+ load += msg->get_amount();
+ break;
}
- if (comm.recv_credit(amount, from)) {
- expected_load += amount;
- received = true;
- }
- if (comm.recv_load(amount, from)) {
- load += amount;
- received = true;
- }
- } while (received);
+ delete msg;
+ }
}
void process::compute()
MSG_task_destroy(task);
}
+void process::finalize()
+{
+ // fixme
+}
+
void process::print_loads(e_xbt_log_priority_t logp)
{
if (!LOG_ISENABLED(logp))