Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
please sonar in the new example
authorMartin Quinson <martin.quinson@loria.fr>
Mon, 27 Nov 2017 21:10:26 +0000 (22:10 +0100)
committerMartin Quinson <martin.quinson@loria.fr>
Mon, 27 Nov 2017 21:12:54 +0000 (22:12 +0100)
.gitignore
examples/s4u/actor-yield/s4u-actor-yield.cpp

index e0eb0b8..f9fd051 100644 (file)
@@ -152,7 +152,6 @@ examples/msg/process-join/process-join
 examples/msg/process-migration/process-migration
 examples/msg/process-startkilltime/process-startkilltime
 examples/msg/process-suspend/process-suspend
-examples/msg/process-yield/process-yield
 examples/msg/app-masterworker/app-masterworker
 examples/msg/mc/bugged1
 examples/msg/mc/bugged1_liveness
@@ -198,6 +197,7 @@ examples/s4u/actor-lifetime/s4u-actor-lifetime
 examples/s4u/actor-migration/s4u-actor-migration
 examples/s4u/actor-priority/s4u-actor-priority
 examples/s4u/actor-suspend/s4u-actor-suspend
+examples/s4u/actor-yield/s4u-actor-yield
 examples/s4u/app-bittorrent/s4u-bittorrent
 examples/s4u/app-masterworker/s4u-app-masterworker
 examples/s4u/app-pingpong/s4u-app-pingpong
@@ -273,6 +273,7 @@ teshsuite/msg/host_on_off_wait/host_on_off_wait
 teshsuite/msg/listen_async/listen_async
 teshsuite/msg/pid/pid
 teshsuite/msg/process/process
+teshsuite/msg/process-yield/process-yield
 teshsuite/msg/storage_client_server/storage_client_server
 teshsuite/msg/task_destroy_cancel/task_destroy_cancel
 teshsuite/msg/task_listen_from/task_listen_from
index 903ade3..168044a 100644 (file)
@@ -18,15 +18,14 @@ XBT_LOG_NEW_DEFAULT_CATEGORY(s4u_actor_yield, "Messages specific for this s4u ex
 class yielder {
  long number_of_yields;
 public: 
- explicit yielder() = default;
  explicit yielder(std::vector<std::string> args)
-{ 
+{
  number_of_yields = std::stod(args[1]);
 }
 void operator()()
 {
- for (int i = 0; i < number_of_yields; i++)
- simgrid::s4u::this_actor::yield();
 for (int i = 0; i < number_of_yields; i++)
  simgrid::s4u::this_actor::yield();
  XBT_INFO("I yielded %ld times. Goodbye now!", number_of_yields);
 }
 };
@@ -34,14 +33,13 @@ void operator()()
 int main(int argc, char* argv[])
 {
  simgrid::s4u::Engine e(&argc, argv);
+
  xbt_assert(argc > 2, "Usage: %s platform_file deployment_file\n"
  "\tExample: %s platform.xml deployment.xml\n",
  argv[0], argv[0]);
+
  e.loadPlatform(argv[1]);  /* - Load the platform description */
  e.registerFunction<yielder>("yielder");
- std::vector<std::string> args; 
 
  e.loadDeployment(argv[2]);