Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Deprecated simcall_mc_random.
authorArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Mon, 1 Mar 2021 09:47:19 +0000 (10:47 +0100)
committerArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Mon, 1 Mar 2021 10:28:56 +0000 (11:28 +0100)
Maybe this can be dropped immediately?.

include/simgrid/simix.h
src/mc/mc_base.cpp
src/simix/libsmx.cpp

index 0ffda2f..ab12a42 100644 (file)
@@ -224,7 +224,7 @@ XBT_ATTRIB_DEPRECATED_v330("Please use s4u::Io::test()") XBT_PUBLIC
 #endif
 /************************** MC simcalls   **********************************/
 SG_BEGIN_DECL
-XBT_PUBLIC int simcall_mc_random(int min, int max);
+XBT_ATTRIB_DEPRECATED_v331("Please use MC_random") XBT_PUBLIC int simcall_mc_random(int min, int max);
 SG_END_DECL
 
 #endif
index 2acb0b5..ba83cc9 100644 (file)
@@ -29,8 +29,12 @@ int MC_random(int min, int max)
 #if SIMGRID_HAVE_MC
   xbt_assert(mc_model_checker == nullptr);
 #endif
-  /* TODO, if the MC is disabled we do not really need to make a simcall for this :) */
-  return simcall_mc_random(min, max);
+  if (not MC_is_active() && not MC_record_replay_is_active()) { // no need to do a simcall in this case
+    static simgrid::xbt::random::XbtRandom prng;
+    return prng.uniform_int(min, max);
+  }
+  auto observer = new simgrid::mc::RandomSimcall(SIMIX_process_self(), min, max);
+  return simgrid::kernel::actor::simcall([observer] { return observer->get_value(); }, observer);
 }
 
 namespace simgrid {
index 9e05fbf..fedfec4 100644 (file)
@@ -363,13 +363,9 @@ void simcall_run_blocking(std::function<void()> const& code, simgrid::mc::Simcal
   simcall_BODY_run_blocking(&code);
 }
 
-int simcall_mc_random(int min, int max) {
-  if (not MC_is_active() && not MC_record_replay_is_active()) { // no need to do a simcall in this case
-    static simgrid::xbt::random::XbtRandom prng;
-    return prng.uniform_int(min, max);
-  }
-  auto observer = new simgrid::mc::RandomSimcall(SIMIX_process_self(), min, max);
-  return simgrid::kernel::actor::simcall([observer] { return observer->get_value(); }, observer);
+int simcall_mc_random(int min, int max) // XBT_ATTRIB_DEPRECATD_v331
+{
+  return MC_random(min, max);
 }
 
 /* ************************************************************************** */