Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
cosmetics after integrating #228
[simgrid.git] / examples / s4u / actor-execute / s4u-actor-execute.cpp
1 /* Copyright (c) 2010-2017. The SimGrid Team. All rights reserved.          */
2
3 /* This program is free software; you can redistribute it and/or modify it
4  * under the terms of the license (GNU LGPL) which comes with this package. */
5
6 #include "simgrid/s4u.hpp"
7 #include <cstdlib>
8 #include <iostream>
9
10 static int executor(std::vector<std::string> args)
11 {
12   /* this_actor::execute() tells SimGrid to pause the calling actor
13    * until its host has computed the amount of flops passed as a parameter */
14   simgrid::s4u::this_actor::execute(100);
15
16   /* This simple example does not do anything beyond that */
17   return 0;
18 }
19
20 int main(int argc, char *argv[])
21 {
22   simgrid::s4u::Engine e(&argc, argv);
23   std::vector<std::string> args;
24   xbt_assert(argc > 1, "Usage: %s platform_file\n\tExample: %s msg_platform.xml\n", argv[0], argv[0]);
25
26   e.loadPlatform(argv[1]);
27
28   simgrid::s4u::Actor::createActor("executor", simgrid::s4u::Host::by_name("Tremblay"), executor, args);
29
30   e.run();
31
32   return 0;
33 }