]> AND Private Git Repository - loba.git/blobdiff - process.cpp
Logo AND Algorithmique Numérique Distribuée

Private GIT Repository
Add extract.pl.
[loba.git] / process.cpp
index 338f20de49438d0e2f62708d529df4ecdafcbe39..23c7abf028cd985ef66d92264a790fed9dab9fce 100644 (file)
@@ -156,7 +156,7 @@ double process::sum_of_to_send() const
 double process::load_balance(double /*my_load*/)
 {
     if (lb_iter == 1)           // warn only once
 double process::load_balance(double /*my_load*/)
 {
     if (lb_iter == 1)           // warn only once
-        WARN0("process::load_balance is a no-op!");
+        WARN0("process::load_balance() is a no-op!");
     return 0.0;
 }
 
     return 0.0;
 }
 
@@ -227,6 +227,7 @@ void process::send()
                       bind(&process::send1_no_bookkeeping, this, _1));
         prev_load_broadcast = load;
     }
                       bind(&process::send1_no_bookkeeping, this, _1));
         prev_load_broadcast = load;
     }
+    comm.flush(false);
 }
 
 void process::receive(bool wait)
 }
 
 void process::receive(bool wait)
@@ -234,7 +235,7 @@ void process::receive(bool wait)
     message* msg;
     m_host_t from;
 
     message* msg;
     m_host_t from;
 
-    if (may_receive() && comm.recv(msg, from, wait)) {
+    while (may_receive() && comm.recv(msg, from, wait)) {
         switch (msg->get_type()) {
         case message::INFO: {
             neighbor* n = rev_neigh[from];
         switch (msg->get_type()) {
         case message::INFO: {
             neighbor* n = rev_neigh[from];
@@ -261,7 +262,9 @@ void process::receive(bool wait)
             break;
         }
         delete msg;
             break;
         }
         delete msg;
+        wait = false;           // only wait on first recv
     }
     }
+    comm.flush(false);
 }
 
 void process::finalize1(neighbor& nb)
 }
 
 void process::finalize1(neighbor& nb)
@@ -285,8 +288,10 @@ void process::finalize()
 
     DEBUG2("wait for CLOSE from %lu neighbor%s",
            (unsigned long )neigh.size(), ESSE(neigh.size()));
 
     DEBUG2("wait for CLOSE from %lu neighbor%s",
            (unsigned long )neigh.size(), ESSE(neigh.size()));
-    while (may_receive())
+    while (may_receive()) {
+        comm.flush(false);
         receive(true);
         receive(true);
+    }
 
     comm.flush(true);
 }
 
     comm.flush(true);
 }