Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Cleanup in log categories
[simgrid.git] / teshsuite / mc / mutex-handling / mutex-handling.cpp
index 162dab9..cd09206 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2015-2020. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2015-2022. 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. */
@@ -24,7 +24,7 @@
 #include "simgrid/s4u/Mailbox.hpp"
 #include "simgrid/s4u/Mutex.hpp"
 
-XBT_LOG_NEW_DEFAULT_CATEGORY(msg_test, "Messages specific for this msg example");
+XBT_LOG_NEW_DEFAULT_CATEGORY(mutex_handling, "Messages specific for this test");
 
 static int receiver(const char* box_name)
 {
@@ -48,7 +48,7 @@ static int sender(const char* box_name, simgrid::s4u::MutexPtr mutex, int value)
   if (mutex)
     mutex->lock();
 
-  mb->put(static_cast<void*>(payload), 8);
+  mb->put(payload, 8);
 
   if (mutex)
     mutex->unlock();
@@ -59,8 +59,9 @@ static int sender(const char* box_name, simgrid::s4u::MutexPtr mutex, int value)
 int main(int argc, char* argv[])
 {
   simgrid::s4u::Engine e(&argc, argv);
-  xbt_assert(argc > 1, "Usage: %s platform_file\n"
-                       "\tExample: %s msg_platform.xml\n",
+  xbt_assert(argc > 1,
+             "Usage: %s platform_file\n"
+             "\tExample: %s platform.xml\n",
              argv[0], argv[0]);
 
   simgrid::s4u::MutexPtr mutex;
@@ -69,12 +70,12 @@ int main(int argc, char* argv[])
 #endif
 
   e.load_platform(argv[1]);
-  simgrid::s4u::Actor::create("receiver", simgrid::s4u::Host::by_name("Jupiter"), receiver, "box");
-  simgrid::s4u::Actor::create("sender", simgrid::s4u::Host::by_name("Boivin"), sender, "box", mutex, 1);
-  simgrid::s4u::Actor::create("sender", simgrid::s4u::Host::by_name("Fafard"), sender, "box", mutex, 2);
+  simgrid::s4u::Actor::create("receiver", e.host_by_name("Jupiter"), receiver, "box");
+  simgrid::s4u::Actor::create("sender", e.host_by_name("Boivin"), sender, "box", mutex, 1);
+  simgrid::s4u::Actor::create("sender", e.host_by_name("Fafard"), sender, "box", mutex, 2);
 
   e.run();
-  XBT_INFO("Simulation time %g", e.get_clock());
+  XBT_INFO("Simulation time %g", simgrid::s4u::Engine::get_clock());
 
   return 0;
 }