Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Update copyright lines for 2022.
[simgrid.git] / examples / cpp / synchro-condition-variable-waituntil / s4u-synchro-condition-variable-waituntil.cpp
index edfc7e4..493c794 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006-2021. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2006-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. */
@@ -16,7 +16,7 @@ static void competitor(int id)
 {
   XBT_INFO("Entering the race...");
   std::unique_lock<simgrid::s4u::Mutex> lck(*mtx);
-  while (!ready) {
+  while (not ready) {
     auto now = simgrid::s4u::Engine::get_clock();
     if (cv->wait_until(lck, now + (id+1)*0.25) == std::cv_status::timeout) {
       XBT_INFO("Out of wait_until (timeout)");
@@ -54,8 +54,7 @@ int main(int argc, char* argv[])
   simgrid::s4u::Engine e(&argc, argv);
   e.load_platform("../../platforms/small_platform.xml");
 
-  auto host = simgrid::s4u::Host::by_name("Tremblay");
-  simgrid::s4u::Actor::create("main", host, main_actor);
+  simgrid::s4u::Actor::create("main", e.host_by_name("Tremblay"), main_actor);
 
   e.run();
   return 0;