X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/69aaa26fa5228c31e55086fa166479732a9cd1b7..42a689df45fca8334757bf342483b75ddf4a9835:/examples/cpp/synchro-semaphore/s4u-synchro-semaphore.cpp diff --git a/examples/cpp/synchro-semaphore/s4u-synchro-semaphore.cpp b/examples/cpp/synchro-semaphore/s4u-synchro-semaphore.cpp index d6da00517b..7acc1ac3d3 100644 --- a/examples/cpp/synchro-semaphore/s4u-synchro-semaphore.cpp +++ b/examples/cpp/synchro-semaphore/s4u-synchro-semaphore.cpp @@ -16,9 +16,9 @@ const char* buffer; /* Wh simgrid::s4u::SemaphorePtr sem_empty = simgrid::s4u::Semaphore::create(1); /* indicates whether the buffer is empty */ simgrid::s4u::SemaphorePtr sem_full = simgrid::s4u::Semaphore::create(0); /* indicates whether the buffer is full */ -static void producer(const std::vector* args) +static void producer(const std::vector& args) { - for (auto const& str : *args) { + for (auto const& str : args) { sem_empty->acquire(); XBT_INFO("Pushing '%s'", str.c_str()); buffer = str.c_str(); @@ -45,7 +45,7 @@ int main(int argc, char **argv) std::vector args({"one", "two", "three", ""}); simgrid::s4u::Engine e(&argc, argv); e.load_platform("../../platforms/two_hosts.xml"); - simgrid::s4u::Actor::create("producer", simgrid::s4u::Host::by_name("Tremblay"), producer, &args); + simgrid::s4u::Actor::create("producer", simgrid::s4u::Host::by_name("Tremblay"), producer, std::cref(args)); simgrid::s4u::Actor::create("consumer", simgrid::s4u::Host::by_name("Jupiter"), consumer); e.run();