X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/af4023f2adc7976a736077c23829d217e7b89637..b9625f82f86db0674e911887addce45dca31b57f:/examples/s4u/actor-yield/s4u-actor-yield.cpp diff --git a/examples/s4u/actor-yield/s4u-actor-yield.cpp b/examples/s4u/actor-yield/s4u-actor-yield.cpp index 72936fe09f..9ef0d79ec0 100644 --- a/examples/s4u/actor-yield/s4u-actor-yield.cpp +++ b/examples/s4u/actor-yield/s4u-actor-yield.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2017. The SimGrid Team. All rights reserved. */ +/* Copyright (c) 2017-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. */ @@ -14,13 +14,13 @@ * It can also be used to benchmark our context-switching mechanism. */ XBT_LOG_NEW_DEFAULT_CATEGORY(s4u_actor_yield, "Messages specific for this s4u example"); -/* Main function of the Yielder process */ +/* Main function of the Yielder actor */ class yielder { long number_of_yields; public: - explicit yielder(std::vector args) { number_of_yields = std::stod(args[1]); } - void operator()() + explicit yielder(std::vector args) { number_of_yields = std::stol(args[1]); } + void operator()() const { for (int i = 0; i < number_of_yields; i++) simgrid::s4u::this_actor::yield(); @@ -36,10 +36,10 @@ int main(int argc, char* argv[]) "\tExample: %s platform.xml deployment.xml\n", argv[0], argv[0]); - e.loadPlatform(argv[1]); /* - Load the platform description */ - e.registerFunction("yielder"); + e.load_platform(argv[1]); /* Load the platform description */ + e.register_actor("yielder"); /* Register the class representing the actors */ - e.loadDeployment(argv[2]); + e.load_deployment(argv[2]); e.run(); /* - Run the simulation */