From 1585b49c3b4c38379d8ebc955f0c86c8b3467aba Mon Sep 17 00:00:00 2001
From: Arnaud Giersch <arnaud.giersch@iut-bm.univ-fcomte.fr>
Date: Wed, 1 Jun 2011 17:01:33 +0200
Subject: [PATCH 1/1] Be consistent, and start lb-loop by a receive too.

---
 NOTES       | 2 +-
 process.cpp | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/NOTES b/NOTES
index 19fafe8..71e2729 100644
--- a/NOTES
+++ b/NOTES
@@ -47,10 +47,10 @@ thread, and a load-balancing thread.
   ---------------------
 
     Loop
+    | receive ctrl messages
     | call load-balancing algorithm
     | send ctrl messages
     | sleep (min_lb_iter_duration)
-    | receive ctrl messages
     +-
     send CLOSE on ctrl for all neighbors
     wait for CLOSE on ctrl from all neighbors
diff --git a/process.cpp b/process.cpp
index 2de3016..47dd94a 100644
--- a/process.cpp
+++ b/process.cpp
@@ -127,6 +127,8 @@ void process::load_balance_loop()
             ++lb_iter;
         }
 
+        ctrl_receive(0.0);
+
         mutex.acquire();
         if (!opt::bookkeeping)
             expected_load = real_load - get_sum_of_to_send();
@@ -150,7 +152,6 @@ void process::load_balance_loop()
         mutex.release();
 
         sleep_until_date(next_iter_after_date, opt::min_lb_iter_duration);
-        ctrl_receive(0.0);
     }
 
     XBT_VERB("Going to finalize for %s...", __func__);
-- 
2.39.5