X-Git-Url: https://bilbo.iut-bm.univ-fcomte.fr/and/gitweb/loba.git/blobdiff_plain/6f5ec5fdc42f96a8fe95f4b846b163d4dc92e0c8..f4125505064e3ff346b31ab9e48f894672e5a7a7:/process.cpp?ds=sidebyside diff --git a/process.cpp b/process.cpp index 4ee3647..b30fab4 100644 --- a/process.cpp +++ b/process.cpp @@ -54,6 +54,8 @@ int process::run() * compute load balancing; * send tasks to neighbors; * } + * finalize; + * wait for pending messages; */ /* Open Questions : @@ -69,24 +71,22 @@ int process::run() 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() @@ -98,6 +98,11 @@ 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))