Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
convert two tesh to use s4u instead of using SIMIX directly
[simgrid.git] / teshsuite / simix / generic-simcalls / generic-simcalls.cpp
index 718741b..0fb69ea 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2016-2019. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2016-2020. The SimGrid Team. All rights reserved.          */
 
 /* 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. */
@@ -8,8 +8,9 @@
 
 #include <xbt/future.hpp>
 
-#include <simgrid/engine.h>
 #include <simgrid/kernel/future.hpp>
+#include <simgrid/s4u/Actor.hpp>
+#include <simgrid/s4u/Engine.hpp>
 #include <simgrid/simix.hpp>
 #include <simgrid/simix/blocking_simcall.hpp>
 #include <xbt/log.h>
@@ -60,7 +61,7 @@ static void master()
     XBT_INFO("Exception caught: %s", e.what());
   }
 
-  // Synchronize on a successul Future<int> and get the value:
+  // Synchronize on a successful Future<int> and get the value:
   int res = simgrid::simix::kernel_sync([] {
     return kernel_wait_until(30).then([](simgrid::kernel::Future<void> f) {
       f.get();
@@ -70,7 +71,7 @@ static void master()
   });
   XBT_INFO("kernel_sync with value returned with %i", res);
 
-  // Synchronize on a successul Future<int> and get the value:
+  // Synchronize on a successful Future<int> and get the value:
   simgrid::simix::Future<int> future = simgrid::simix::kernel_async([] {
     return kernel_wait_until(50).then([](simgrid::kernel::Future<void> f) {
       f.get();
@@ -81,7 +82,7 @@ static void master()
   res = future.get();
   XBT_INFO("kernel_async with value returned with %i", res);
 
-  // Synchronize on a successul Future<int> and get the value:
+  // Synchronize on a successful Future<int> and get the value:
   future = simgrid::simix::kernel_async([] {
     return kernel_wait_until(60).then([](simgrid::kernel::Future<void> f) {
       f.get();
@@ -99,10 +100,10 @@ static void master()
 
 int main(int argc, char* argv[])
 {
-  SIMIX_global_init(&argc, argv);
+  simgrid::s4u::Engine e(&argc, argv);
   xbt_assert(argc == 2, "Usage: %s platform.xml\n", argv[0]);
-  simgrid_load_platform(argv[1]);
-  simcall_process_create("master", example::master, NULL, sg_host_by_name("Tremblay"), NULL);
-  SIMIX_run();
+  e.load_platform(argv[1]);
+  simgrid::s4u::Actor::create("master", e.host_by_name("Tremblay"), example::master);
+  e.run();
   return 0;
 }