Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
reindent (no real change)
authorMartin Quinson <martin.quinson@loria.fr>
Mon, 27 Nov 2017 21:10:49 +0000 (22:10 +0100)
committerMartin Quinson <martin.quinson@loria.fr>
Mon, 27 Nov 2017 21:12:54 +0000 (22:12 +0100)
examples/s4u/actor-yield/s4u-actor-yield.cpp

index 168044a..72936fe 100644 (file)
@@ -6,44 +6,42 @@
 #include "simgrid/s4u.hpp"
 
 /* This example does not much: It just spans over-polite actor that yield a large amount
-* of time before ending.
-*
-* This serves as an example for the simgrid::s4u::this_actor::yield() function, with which an actor can request
-* to be rescheduled after the other actor that are ready at the current timestamp.
-*
-* It can also be used to benchmark our context-switching mechanism.
-*/
+ * of time before ending.
+ *
+ * This serves as an example for the simgrid::s4u::this_actor::yield() function, with which an actor can request
+ * to be rescheduled after the other actor that are ready at the current timestamp.
+ *
+ * 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 */
 class yielder {
- long number_of_yields;
-public: 
- explicit yielder(std::vector<std::string> args)
-{
- number_of_yields = std::stod(args[1]);
-}
-void operator()()
-{
-  for (int i = 0; i < number_of_yields; i++)
-   simgrid::s4u::this_actor::yield();
- XBT_INFO("I yielded %ld times. Goodbye now!", number_of_yields);
-}
+  long number_of_yields;
+
+public:
+  explicit yielder(std::vector<std::string> args) { number_of_yields = std::stod(args[1]); }
+  void operator()()
+  {
+    for (int i = 0; i < number_of_yields; i++)
+      simgrid::s4u::this_actor::yield();
+    XBT_INFO("I yielded %ld times. Goodbye now!", number_of_yields);
+  }
 };
 
 int main(int argc, char* argv[])
 {
- simgrid::s4u::Engine e(&argc, argv);
 simgrid::s4u::Engine e(&argc, argv);
 
- xbt_assert(argc > 2, "Usage: %s platform_file deployment_file\n"
- "\tExample: %s platform.xml deployment.xml\n",
- argv[0], argv[0]);
 xbt_assert(argc > 2, "Usage: %s platform_file deployment_file\n"
                      "\tExample: %s platform.xml deployment.xml\n",
            argv[0], argv[0]);
 
e.loadPlatform(argv[1]);  /* - Load the platform description */
- e.registerFunction<yielder>("yielder");
 e.loadPlatform(argv[1]); /* - Load the platform description */
 e.registerFunction<yielder>("yielder");
 
- e.loadDeployment(argv[2]);
 e.loadDeployment(argv[2]);
 
e.run();  /* - Run the simulation */
 e.run(); /* - Run the simulation */
 
- return 0;
 return 0;
 }