Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
remove the argc/argv version of simcall_process_create
authorMartin Quinson <martin.quinson@ens-rennes.fr>
Sun, 11 Nov 2018 02:54:30 +0000 (03:54 +0100)
committerMartin Quinson <martin.quinson@ens-rennes.fr>
Sun, 11 Nov 2018 02:54:30 +0000 (03:54 +0100)
include/simgrid/simix.h
src/simix/ActorImpl.cpp
teshsuite/s4u/activity-lifecycle/activity-lifecycle.cpp
teshsuite/simix/generic-simcalls/generic-simcalls.cpp
teshsuite/simix/stack-overflow/stack-overflow.cpp

index 210c3b5..f599f48 100644 (file)
@@ -200,13 +200,6 @@ XBT_PUBLIC e_smx_state_t simcall_execution_test(smx_activity_t execution);
 
 /**************************** Process simcalls ********************************/
 SG_BEGIN_DECL()
 
 /**************************** Process simcalls ********************************/
 SG_BEGIN_DECL()
-/* Constructor and Destructor */
-#ifdef __cplusplus
-XBT_PUBLIC smx_actor_t simcall_process_create(std::string name, xbt_main_func_t code, void* data, sg_host_t host,
-                                              int argc, char** argv,
-                                              std::unordered_map<std::string, std::string>* properties);
-#endif
-
 XBT_ATTRIB_DEPRECATED_v324("Please use ActorImpl::throw_exception") XBT_PUBLIC
     void SIMIX_process_throw(smx_actor_t process, xbt_errcat_t cat, int value, const char* mesg);
 
 XBT_ATTRIB_DEPRECATED_v324("Please use ActorImpl::throw_exception") XBT_PUBLIC
     void SIMIX_process_throw(smx_actor_t process, xbt_errcat_t cat, int value, const char* mesg);
 
index 88734d6..f1ccd3c 100644 (file)
@@ -857,17 +857,6 @@ void SIMIX_process_on_exit(smx_actor_t process, std::function<void(int, void*)>
  * @param argv second argument passed to @a code
  * @param properties the properties of the process
  */
  * @param argv second argument passed to @a code
  * @param properties the properties of the process
  */
-smx_actor_t simcall_process_create(std::string name, xbt_main_func_t code, void* data, sg_host_t host, int argc,
-                                   char** argv, std::unordered_map<std::string, std::string>* properties)
-{
-  auto wrapped_code = simgrid::xbt::wrap_main(code, argc, argv);
-  for (int i = 0; i != argc; ++i)
-    xbt_free(argv[i]);
-  xbt_free(argv);
-  smx_actor_t res = simcall_process_create(name, std::move(wrapped_code), data, host, properties);
-  return res;
-}
-
 smx_actor_t simcall_process_create(std::string name, simgrid::simix::ActorCode code, void* data, sg_host_t host,
                                    std::unordered_map<std::string, std::string>* properties)
 {
 smx_actor_t simcall_process_create(std::string name, simgrid::simix::ActorCode code, void* data, sg_host_t host,
                                    std::unordered_map<std::string, std::string>* properties)
 {
index 62c49c1..8e82825 100644 (file)
@@ -204,7 +204,7 @@ static void test_comm_killsend()
 /* We need an extra actor here, so that it can sleep until the end of each test */
 static void main_dispatcher()
 {
 /* We need an extra actor here, so that it can sleep until the end of each test */
 static void main_dispatcher()
 {
-  run_test("sleep", test_sleep);
+  run_test("sleep", static_cast<std::function<void()>>(test_sleep));
   run_test("sleep killed at start", test_sleep_kill_begin);
   run_test("sleep killed in middle", test_sleep_kill_middle);
   /* We cannot kill right at the end of the action because killer actors are always rescheduled to the end of the round
   run_test("sleep killed at start", test_sleep_kill_begin);
   run_test("sleep killed in middle", test_sleep_kill_middle);
   /* We cannot kill right at the end of the action because killer actors are always rescheduled to the end of the round
index c21b12d..c1bd3d5 100644 (file)
@@ -31,7 +31,7 @@ static simgrid::kernel::Future<void> kernel_wait_until(double date)
   return future;
 }
 
   return future;
 }
 
-static int master(int /*argc*/, char** /*argv*/)
+static void master()
 {
   // Test the simple immediate execution:
   XBT_INFO("Start");
 {
   // Test the simple immediate execution:
   XBT_INFO("Start");
@@ -94,8 +94,6 @@ static int master(int /*argc*/, char** /*argv*/)
   XBT_INFO("The future is %s", future.is_ready() ? "ready" : "not ready");
   res = future.get();
   XBT_INFO("kernel_async with value returned with %i", res);
   XBT_INFO("The future is %s", future.is_ready() ? "ready" : "not ready");
   res = future.get();
   XBT_INFO("kernel_async with value returned with %i", res);
-
-  return 0;
 }
 }
 
 }
 }
 
@@ -103,9 +101,8 @@ int main(int argc, char* argv[])
 {
   SIMIX_global_init(&argc, argv);
   xbt_assert(argc == 2, "Usage: %s platform.xml\n", argv[0]);
 {
   SIMIX_global_init(&argc, argv);
   xbt_assert(argc == 2, "Usage: %s platform.xml\n", argv[0]);
-  simgrid_register_function("master", example::master);
   simgrid_load_platform(argv[1]);
   simgrid_load_platform(argv[1]);
-  simcall_process_create("master", example::master, NULL, sg_host_by_name("Tremblay"), 0, NULL, NULL);
+  simcall_process_create("master", example::master, NULL, sg_host_by_name("Tremblay"), NULL);
   SIMIX_run();
   return 0;
 }
   SIMIX_run();
   return 0;
 }
index 8c56b32..0c19283 100644 (file)
@@ -5,7 +5,7 @@
 /* This program is free software; you can redistribute it and/or modify it
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
 /* This program is free software; you can redistribute it and/or modify it
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
-#include "simgrid/simix.h"
+#include "simgrid/simix.hpp"
 #include "xbt/log.h"
 #include <simgrid/engine.h>
 
 #include "xbt/log.h"
 #include <simgrid/engine.h>
 
@@ -28,7 +28,7 @@ static unsigned collatz(unsigned c0, unsigned n)
   return x;
 }
 
   return x;
 }
 
-static int master(int argc, char* argv[])
+static void master()
 {
   XBT_INFO("Launching our nice bugged recursive function...");
   unsigned i = 1;
 {
   XBT_INFO("Launching our nice bugged recursive function...");
   unsigned i = 1;
@@ -37,7 +37,6 @@ static int master(int argc, char* argv[])
     unsigned res = collatz(i, i);
     XBT_VERB("collatz(%u, %u) returned %u", i, i, res);
   }
     unsigned res = collatz(i, i);
     XBT_VERB("collatz(%u, %u) returned %u", i, i, res);
   }
-  return 0;
 }
 
 int main(int argc, char* argv[])
 }
 
 int main(int argc, char* argv[])
@@ -46,9 +45,8 @@ int main(int argc, char* argv[])
 
   xbt_assert(argc == 2, "Usage: %s platform.xml\n", argv[0]);
 
 
   xbt_assert(argc == 2, "Usage: %s platform.xml\n", argv[0]);
 
-  simgrid_register_function("master", master);
   simgrid_load_platform(argv[1]);
   simgrid_load_platform(argv[1]);
-  simcall_process_create("master", master, NULL, sg_host_by_name("Tremblay"), 0, NULL, NULL);
+  simcall_process_create("master", master, NULL, sg_host_by_name("Tremblay"), NULL);
   SIMIX_run();
 
   return 0;
   SIMIX_run();
 
   return 0;