Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Give a way to add binaries to the list that shouldn't be messed with by sthread
[simgrid.git] / examples / cpp / mc-bugged1 / s4u-mc-bugged1.cpp
index a2b47d9a1d9bd850088a4f766ecfc41722111621..e10b78a902d21057cd219425ef2a8098b546aed9 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2010-2022. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2010-2023. 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. */
@@ -14,6 +14,7 @@
 constexpr int N = 3;
 
 XBT_LOG_NEW_DEFAULT_CATEGORY(example, "this example");
+namespace sg4 = simgrid::s4u;
 
 static void server()
 {
@@ -21,7 +22,7 @@ static void server()
   int count     = 0;
   while (count < N) {
     received.reset();
-    received = simgrid::s4u::Mailbox::by_name("mymailbox")->get_unique<int>();
+    received = sg4::Mailbox::by_name("mymailbox")->get_unique<int>();
     count++;
   }
   int value_got = *received;
@@ -33,21 +34,21 @@ static void server()
 static void client(int id)
 {
   auto* payload = new int(id);
-  simgrid::s4u::Mailbox::by_name("mymailbox")->put(payload, 10000);
+  sg4::Mailbox::by_name("mymailbox")->put(payload, 10000);
 
   XBT_INFO("Sent!");
 }
 
 int main(int argc, char* argv[])
 {
-  simgrid::s4u::Engine e(&argc, argv);
+  sg4::Engine e(&argc, argv);
 
   e.load_platform(argv[1]);
 
-  simgrid::s4u::Actor::create("server", e.host_by_name("HostA"), server);
-  simgrid::s4u::Actor::create("client", e.host_by_name("HostB"), client, 1);
-  simgrid::s4u::Actor::create("client", e.host_by_name("HostC"), client, 2);
-  simgrid::s4u::Actor::create("client", e.host_by_name("HostD"), client, 3);
+  sg4::Actor::create("server", e.host_by_name("HostA"), server);
+  sg4::Actor::create("client", e.host_by_name("HostB"), client, 1);
+  sg4::Actor::create("client", e.host_by_name("HostC"), client, 2);
+  sg4::Actor::create("client", e.host_by_name("HostD"), client, 3);
 
   e.run();
   return 0;