X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/022dfa9c45540c987b7e6095d89f4b051fba02ed..53782855f0f3041e92f763891722e8a253479451:/examples/s4u/app-masterworker/s4u_app-masterworker.cpp diff --git a/examples/s4u/app-masterworker/s4u_app-masterworker.cpp b/examples/s4u/app-masterworker/s4u_app-masterworker.cpp index bc5d34a138..d6797f709d 100644 --- a/examples/s4u/app-masterworker/s4u_app-masterworker.cpp +++ b/examples/s4u/app-masterworker/s4u_app-masterworker.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2010-2016. The SimGrid Team. All rights reserved. */ +/* Copyright (c) 2010-2017. 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. */ @@ -42,14 +42,14 @@ public: /* - Send the task to the @ref worker */ char* payload = bprintf("%f", comp_size); - simgrid::s4u::this_actor::send(mailbox, payload, comm_size); + mailbox->send(payload, comm_size); } XBT_INFO("All tasks have been dispatched. Let's tell everybody the computation is over."); for (int i = 0; i < workers_count; i++) { /* - Eventually tell all the workers to stop by sending a "finalize" task */ mailbox = simgrid::s4u::Mailbox::byName(std::string("worker-") + std::to_string(i % workers_count)); - simgrid::s4u::this_actor::send(mailbox, xbt_strdup("finalize"), 0); + mailbox->send(xbt_strdup("finalize"), 0); } } }; @@ -70,7 +70,7 @@ public: void operator()() { while (1) { /* The worker waits in an infinite loop for tasks sent by the \ref master */ - char* res = static_cast(simgrid::s4u::this_actor::recv(mailbox)); + char* res = static_cast(mailbox->recv()); xbt_assert(res != nullptr, "MSG_task_get failed"); if (strcmp(res, "finalize") == 0) { /* - Exit if 'finalize' is received */ @@ -102,5 +102,6 @@ int main(int argc, char* argv[]) XBT_INFO("Simulation time %g", e->getClock()); + delete e; return 0; }