X-Git-Url: https://bilbo.iut-bm.univ-fcomte.fr/and/gitweb/loba.git/blobdiff_plain/d79c6aa768cb68806408632c832e5e1330e451a6..fb7c087879f5cfc2657a4fc04847106b5f75c122:/process.cpp?ds=sidebyside diff --git a/process.cpp b/process.cpp index 6549638..880bbd0 100644 --- a/process.cpp +++ b/process.cpp @@ -99,7 +99,14 @@ int process::run() if (opt::log_rate >= 0) XBT_INFO("Initial load: %g", real_load); XBT_VERB("Starting..."); + mutex.acquire(); lb_thread->start(); + while (lb_iter <= opt::comp_iter_delay) + cond.wait(mutex); + mutex.release(); + double sleep_duration = opt::comp_time_delay - MSG_get_clock(); + if (sleep_duration > 0.0) + MSG_process_sleep(sleep_duration); compute_loop(); lb_thread->wait(); XBT_VERB("Done."); @@ -113,7 +120,14 @@ void process::load_balance_loop() double next_iter_after_date = MSG_get_clock() + opt::min_lb_iter_duration; while (still_running()) { - ++lb_iter; + if (lb_iter == opt::comp_iter_delay) { + mutex.acquire(); + ++lb_iter; + cond.signal(); + mutex.release(); + } else { + ++lb_iter; + } if (opt::log_rate && lb_iter % opt::log_rate == 0) { if (opt::bookkeeping)