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

Private GIT Repository
Neighbor/debt should be protected against concurrent access too.
[loba.git] / process.cpp
index 3df086b9c611ce6654df3521fabc1f2e2f94c871..21eeb7a194373fdd0b195698dac4360100220f0e 100644 (file)
@@ -135,7 +135,6 @@ void process::load_balance_loop()
             XBT_INFO("(%u:%u) current load: %g", lb_iter, comp_iter, real_load);
             XBT_VERB("... expected load: %g", expected_load);
         }
             XBT_INFO("(%u:%u) current load: %g", lb_iter, comp_iter, real_load);
             XBT_VERB("... expected load: %g", expected_load);
         }
-        mutex.release();
 
         if (expected_load > 0.0)
             load_balance();
 
         if (expected_load > 0.0)
             load_balance();
@@ -146,6 +145,7 @@ void process::load_balance_loop()
         std::for_each(neigh.begin(), neigh.end(),
                       bind(&process::ctrl_send, this, _1));
         prev_load_broadcast = expected_load;
         std::for_each(neigh.begin(), neigh.end(),
                       bind(&process::ctrl_send, this, _1));
         prev_load_broadcast = expected_load;
+        mutex.release();
 
         sleep_until_date(next_iter_after_date, opt::min_lb_iter_duration);
         ctrl_receive(0.0);
 
         sleep_until_date(next_iter_after_date, opt::min_lb_iter_duration);
         ctrl_receive(0.0);