From: Arnaud Giersch Date: Tue, 22 Jun 2021 20:37:17 +0000 (+0200) Subject: Prefer a reference for first parameter of {test,wait}_{all,any}. X-Git-Tag: v3.28~77 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/69aaa26fa5228c31e55086fa166479732a9cd1b7 Prefer a reference for first parameter of {test,wait}_{all,any}. --- diff --git a/ChangeLog b/ChangeLog index 1d8b498cc6..c5f64633e2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -8,7 +8,10 @@ New features: associated example (examples/cpp/plugin-prodcons). S4U: - - New: simgrid::s4u::Comm::wait_all_for() (like Comm::Wait_all, but with a timeout). + - New: s4u::Comm::wait_all_for() (like s4u::Comm::wait_all, but with a timeout), + s4u::Io::wait_any(), s4u::Io::wait_any_for(). + - Methods test_all/test_any/wait_all/wait_any in s4u now take their vector + parameter by reference, instead of a pointer. - Fixed a bug where Activity::wait_for() killed the activity on timeout. Explicitly cancel the activity to get back to previous behavior. diff --git a/docs/source/app_s4u.rst b/docs/source/app_s4u.rst index 42bc82c081..f1756f7d74 100644 --- a/docs/source/app_s4u.rst +++ b/docs/source/app_s4u.rst @@ -1886,11 +1886,12 @@ also start direct communications as shown below. .. doxygenfunction:: simgrid::s4u::Comm::cancel .. doxygenfunction:: simgrid::s4u::Comm::start .. doxygenfunction:: simgrid::s4u::Comm::test - .. doxygenfunction:: simgrid::s4u::Comm::test_any(const std::vector< CommPtr > *comms) + .. doxygenfunction:: simgrid::s4u::Comm::test_any(const std::vector< CommPtr >& comms) .. doxygenfunction:: simgrid::s4u::Comm::wait - .. doxygenfunction:: simgrid::s4u::Comm::wait_all(const std::vector< CommPtr > *comms) - .. doxygenfunction:: simgrid::s4u::Comm::wait_any(const std::vector< CommPtr > *comms) - .. doxygenfunction:: simgrid::s4u::Comm::wait_any_for(const std::vector< CommPtr > *comms_in, double timeout) + .. doxygenfunction:: simgrid::s4u::Comm::wait_all(const std::vector< CommPtr >& comms) + .. doxygenfunction:: simgrid::s4u::Comm::wait_all_for(const std::vector< CommPtr >& comms, double timeout) + .. doxygenfunction:: simgrid::s4u::Comm::wait_any(const std::vector< CommPtr >& comms) + .. doxygenfunction:: simgrid::s4u::Comm::wait_any_for(const std::vector< CommPtr >& comms, double timeout) .. doxygenfunction:: simgrid::s4u::Comm::wait_for .. group-tab:: Python @@ -1997,8 +1998,8 @@ Life cycle .. doxygenfunction:: simgrid::s4u::Exec::start .. doxygenfunction:: simgrid::s4u::Exec::test .. doxygenfunction:: simgrid::s4u::Exec::wait - .. doxygenfunction:: simgrid::s4u::Exec::wait_any(std::vector< ExecPtr > *execs) - .. doxygenfunction:: simgrid::s4u::Exec::wait_any_for(std::vector< ExecPtr > *execs, double timeout) + .. doxygenfunction:: simgrid::s4u::Exec::wait_any(std::vector< ExecPtr >& execs) + .. doxygenfunction:: simgrid::s4u::Exec::wait_any_for(std::vector< ExecPtr >& execs, double timeout) .. doxygenfunction:: simgrid::s4u::Exec::wait_for .. group-tab:: Python diff --git a/examples/cpp/app-chainsend/s4u-app-chainsend.cpp b/examples/cpp/app-chainsend/s4u-app-chainsend.cpp index 2a38069714..66c9bb48dc 100644 --- a/examples/cpp/app-chainsend/s4u-app-chainsend.cpp +++ b/examples/cpp/app-chainsend/s4u-app-chainsend.cpp @@ -61,7 +61,7 @@ public: simgrid::s4u::CommPtr comm = me->get_async(&received); pending_recvs.push_back(comm); - int idx = simgrid::s4u::Comm::wait_any(&pending_recvs); + int idx = simgrid::s4u::Comm::wait_any(pending_recvs); if (idx != -1) { comm = pending_recvs.at(idx); XBT_DEBUG("Peer %s got a 'SEND_DATA' message", me->get_cname()); @@ -116,7 +116,7 @@ public: simgrid::s4u::CommPtr comm = first->put_async(new FilePiece(), MESSAGE_SEND_DATA_HEADER_SIZE + PIECE_SIZE); pending_sends.push_back(comm); } - simgrid::s4u::Comm::wait_all(&pending_sends); + simgrid::s4u::Comm::wait_all(pending_sends); } Broadcaster(int hostcount, unsigned int piece_count) : piece_count(piece_count) @@ -139,7 +139,7 @@ static void peer() p.joinChain(); p.forwardFile(); - simgrid::s4u::Comm::wait_all(&p.pending_sends); + simgrid::s4u::Comm::wait_all(p.pending_sends); double end_time = simgrid::s4u::Engine::get_clock(); XBT_INFO("### %f %llu bytes (Avg %f MB/s); copy finished (simulated).", end_time - start_time, p.received_bytes, diff --git a/examples/cpp/clusters-multicpu/s4u-clusters-multicpu.cpp b/examples/cpp/clusters-multicpu/s4u-clusters-multicpu.cpp index 49becd86cd..88f6053584 100644 --- a/examples/cpp/clusters-multicpu/s4u-clusters-multicpu.cpp +++ b/examples/cpp/clusters-multicpu/s4u-clusters-multicpu.cpp @@ -47,7 +47,7 @@ public: XBT_INFO("Done dispatching all messages"); /* Now that all message exchanges were initiated, wait for their completion in one single call */ - sg4::Comm::wait_all(&pending_comms); + sg4::Comm::wait_all(pending_comms); XBT_INFO("Goodbye now!"); } diff --git a/examples/cpp/comm-ready/s4u-comm-ready.cpp b/examples/cpp/comm-ready/s4u-comm-ready.cpp index 25dbce2d59..6cbe694412 100644 --- a/examples/cpp/comm-ready/s4u-comm-ready.cpp +++ b/examples/cpp/comm-ready/s4u-comm-ready.cpp @@ -93,7 +93,7 @@ static void peer(int argc, char** argv) } XBT_INFO("I'm done, just waiting for my peers to receive the messages before exiting"); - sg4::Comm::wait_all(&pending_comms); + sg4::Comm::wait_all(pending_comms); XBT_INFO("Goodbye now!"); } diff --git a/examples/cpp/comm-serialize/s4u-comm-serialize.cpp b/examples/cpp/comm-serialize/s4u-comm-serialize.cpp index 47a2c1ab32..41e44335a7 100644 --- a/examples/cpp/comm-serialize/s4u-comm-serialize.cpp +++ b/examples/cpp/comm-serialize/s4u-comm-serialize.cpp @@ -54,7 +54,7 @@ public: XBT_INFO("Done dispatching all messages"); /* Now that all message exchanges were initiated, wait for their completion in one single call */ - sg4::Comm::wait_all(&pending_comms); + sg4::Comm::wait_all(pending_comms); // sphinx-doc: put-end XBT_INFO("Goodbye now!"); @@ -80,7 +80,7 @@ public: pending_comms.emplace_back(mbox->get_async(pending_msgs[i].get())); } while (not pending_comms.empty()) { - int index = sg4::Comm::wait_any(&pending_comms); + int index = sg4::Comm::wait_any(pending_comms); std::string* msg = *pending_msgs[index]; XBT_INFO("I got '%s'.", msg->c_str()); /* cleanup memory and remove from vectors */ diff --git a/examples/cpp/comm-waitall/s4u-comm-waitall.cpp b/examples/cpp/comm-waitall/s4u-comm-waitall.cpp index 79e78acbe7..13902a4532 100644 --- a/examples/cpp/comm-waitall/s4u-comm-waitall.cpp +++ b/examples/cpp/comm-waitall/s4u-comm-waitall.cpp @@ -68,7 +68,7 @@ public: XBT_INFO("Done dispatching all messages"); /* Now that all message exchanges were initiated, wait for their completion in one single call */ - sg4::Comm::wait_all(&pending_comms); + sg4::Comm::wait_all(pending_comms); // sphinx-doc: put-end XBT_INFO("Goodbye now!"); diff --git a/examples/cpp/comm-waitany/s4u-comm-waitany.cpp b/examples/cpp/comm-waitany/s4u-comm-waitany.cpp index e8f20ae740..fa8b117cdb 100644 --- a/examples/cpp/comm-waitany/s4u-comm-waitany.cpp +++ b/examples/cpp/comm-waitany/s4u-comm-waitany.cpp @@ -77,7 +77,7 @@ public: * Even in this simple example, the pending comms do not terminate in the exact same order of creation. */ while (not pending_comms.empty()) { - int changed_pos = sg4::Comm::wait_any(&pending_comms); + int changed_pos = sg4::Comm::wait_any(pending_comms); pending_comms.erase(pending_comms.begin() + changed_pos); if (changed_pos != 0) XBT_INFO("Remove the %dth pending comm: it terminated earlier than another comm that was initiated first.", diff --git a/examples/cpp/energy-link/s4u-energy-link.cpp b/examples/cpp/energy-link/s4u-energy-link.cpp index c5a7558980..40dce8614d 100644 --- a/examples/cpp/energy-link/s4u-energy-link.cpp +++ b/examples/cpp/energy-link/s4u-energy-link.cpp @@ -35,7 +35,7 @@ static void sender(std::vector args) std::vector comms; for (int i = 0; i < flow_amount; i++) comms.push_back(mailbox->put_async(bprintf("%d", i), comm_size)); - simgrid::s4u::Comm::wait_all(&comms); + simgrid::s4u::Comm::wait_all(comms); } XBT_INFO("sender done."); } @@ -59,7 +59,7 @@ static void receiver(std::vector args) for (int i = 0; i < flow_amount; i++) comms.push_back(mailbox->get_async(&data[i])); - simgrid::s4u::Comm::wait_all(&comms); + simgrid::s4u::Comm::wait_all(comms); for (int i = 0; i < flow_amount; i++) xbt_free(data[i]); } diff --git a/examples/cpp/exec-dependent/s4u-exec-dependent.cpp b/examples/cpp/exec-dependent/s4u-exec-dependent.cpp index 68187bf9dc..834921df7a 100644 --- a/examples/cpp/exec-dependent/s4u-exec-dependent.cpp +++ b/examples/cpp/exec-dependent/s4u-exec-dependent.cpp @@ -41,7 +41,7 @@ static void worker() // wait for the completion of all activities while (not pending_execs.empty()) { - int changed_pos = simgrid::s4u::Exec::wait_any_for(&pending_execs, -1); + int changed_pos = simgrid::s4u::Exec::wait_any_for(pending_execs, -1); XBT_INFO("Exec '%s' is complete", pending_execs[changed_pos]->get_cname()); pending_execs.erase(pending_execs.begin() + changed_pos); } diff --git a/examples/cpp/exec-waitany/s4u-exec-waitany.cpp b/examples/cpp/exec-waitany/s4u-exec-waitany.cpp index 07e6ec2670..6b9f365c5a 100644 --- a/examples/cpp/exec-waitany/s4u-exec-waitany.cpp +++ b/examples/cpp/exec-waitany/s4u-exec-waitany.cpp @@ -35,9 +35,9 @@ static void worker(bool with_timeout) while (not pending_executions.empty()) { int pos; if (with_timeout) - pos = simgrid::s4u::Exec::wait_any_for(&pending_executions, 4); + pos = simgrid::s4u::Exec::wait_any_for(pending_executions, 4); else - pos = simgrid::s4u::Exec::wait_any(&pending_executions); + pos = simgrid::s4u::Exec::wait_any(pending_executions); if (pos < 0) { XBT_INFO("Do not wait any longer for an activity"); diff --git a/examples/cpp/io-dependent/s4u-io-dependent.cpp b/examples/cpp/io-dependent/s4u-io-dependent.cpp index 62fce80f17..217413035e 100644 --- a/examples/cpp/io-dependent/s4u-io-dependent.cpp +++ b/examples/cpp/io-dependent/s4u-io-dependent.cpp @@ -45,7 +45,7 @@ static void test() // wait for the completion of all activities bob_compute->wait(); while (not pending_ios.empty()) { - int changed_pos = simgrid::s4u::Io::wait_any(&pending_ios); + int changed_pos = simgrid::s4u::Io::wait_any(pending_ios); XBT_INFO("Io '%s' is complete", pending_ios[changed_pos]->get_cname()); pending_ios.erase(pending_ios.begin() + changed_pos); } diff --git a/include/simgrid/s4u/Comm.hpp b/include/simgrid/s4u/Comm.hpp index 946b175274..66a8c6f694 100644 --- a/include/simgrid/s4u/Comm.hpp +++ b/include/simgrid/s4u/Comm.hpp @@ -69,17 +69,26 @@ public: /*! take a vector s4u::CommPtr and return when one of them is finished. * The return value is the rank of the first finished CommPtr. */ - static int wait_any(const std::vector* comms) { return wait_any_for(comms, -1); } + static int wait_any(const std::vector& comms) { return wait_any_for(comms, -1); } /*! Same as wait_any, but with a timeout. Return -1 if the timeout occurs.*/ - static int wait_any_for(const std::vector* comms_in, double timeout); + static int wait_any_for(const std::vector& comms, double timeout); /*! take a vector s4u::CommPtr and return when all of them is finished. */ - static void wait_all(const std::vector* comms); + static void wait_all(const std::vector& comms); /*! Same as wait_all, but with a timeout. Return the number of terminated comm (less than comms.size() if the timeout * occurs). */ - static size_t wait_all_for(const std::vector* comms, double timeout); + static size_t wait_all_for(const std::vector& comms, double timeout); /*! take a vector s4u::CommPtr and return the rank of the first finished one (or -1 if none is done). */ - static int test_any(const std::vector* comms); + static int test_any(const std::vector& comms); + + XBT_ATTRIB_DEPRECATED_v332("Please use a plain vector for parameter") + static int wait_any(const std::vector* comms) { return wait_any_for(*comms, -1); } + XBT_ATTRIB_DEPRECATED_v332("Please use a plain vector for first parameter") + static int wait_any_for(const std::vector* comms, double timeout) { return wait_any_for(*comms, timeout); } + XBT_ATTRIB_DEPRECATED_v332("Please use a plain vector for parameter") + static void wait_all(const std::vector* comms) { wait_all(*comms); } + XBT_ATTRIB_DEPRECATED_v332("Please use a plain vector for parameter") + static int test_any(const std::vector* comms) { return test_any(*comms); } Comm* start() override; Comm* wait_for(double timeout) override; diff --git a/include/simgrid/s4u/Exec.hpp b/include/simgrid/s4u/Exec.hpp index ee5be7eb18..3fe8ccb96a 100644 --- a/include/simgrid/s4u/Exec.hpp +++ b/include/simgrid/s4u/Exec.hpp @@ -51,9 +51,14 @@ public: /*! take a vector of s4u::ExecPtr and return when one of them is finished. * The return value is the rank of the first finished ExecPtr. */ - static int wait_any(std::vector* execs) { return wait_any_for(execs, -1); } + static int wait_any(const std::vector& execs) { return wait_any_for(execs, -1); } /*! Same as wait_any, but with a timeout. If the timeout occurs, parameter last is returned.*/ - static int wait_any_for(std::vector* execs, double timeout); + static int wait_any_for(const std::vector& execs, double timeout); + + XBT_ATTRIB_DEPRECATED_v332("Please use a plain vector for parameter") + static int wait_any(std::vector* execs) { return wait_any_for(*execs, -1); } + XBT_ATTRIB_DEPRECATED_v332("Please use a plain vector for first parameter") + static int wait_any_for(std::vector* execs, double timeout) { return wait_any_for(*execs, timeout); } /** @brief On sequential executions, returns the amount of flops that remain to be done; This cannot be used on * parallel executions. */ diff --git a/include/simgrid/s4u/Io.hpp b/include/simgrid/s4u/Io.hpp index cb08c3d8f7..dbcff8e094 100644 --- a/include/simgrid/s4u/Io.hpp +++ b/include/simgrid/s4u/Io.hpp @@ -37,9 +37,9 @@ public: Io* start() override; /*! take a vector of s4u::IoPtr and return when one of them is finished. * The return value is the rank of the first finished IoPtr. */ - static int wait_any(std::vector* ios) { return wait_any_for(ios, -1); } + static int wait_any(const std::vector& ios) { return wait_any_for(ios, -1); } /*! Same as wait_any, but with a timeout. If the timeout occurs, parameter last is returned.*/ - static int wait_any_for(std::vector* ios, double timeout); + static int wait_any_for(const std::vector& ios, double timeout); double get_remaining() const override; sg_size_t get_performed_ioops() const; diff --git a/src/bindings/python/simgrid_python.cpp b/src/bindings/python/simgrid_python.cpp index b1dd8a03c2..eac19eb65a 100644 --- a/src/bindings/python/simgrid_python.cpp +++ b/src/bindings/python/simgrid_python.cpp @@ -267,10 +267,14 @@ PYBIND11_MODULE(simgrid, m) "Test whether the communication is terminated.") .def("wait", &simgrid::s4u::Comm::wait, py::call_guard(), "Block until the completion of that communication.") - .def("wait_all", &simgrid::s4u::Comm::wait_all, py::call_guard(), - "Block until the completion of all communications in the list.") - .def("wait_any", &simgrid::s4u::Comm::wait_any, py::call_guard(), - "Block until the completion of any communication in the list and return the index of the terminated one."); + // use py::overload_cast for wait_all/wait_any, until the overload marked XBT_ATTRIB_DEPRECATED_v332 is removed + .def_static("wait_all", + py::overload_cast&>(&simgrid::s4u::Comm::wait_all), + py::call_guard(), "Block until the completion of all communications in the list.") + .def_static( + "wait_any", py::overload_cast&>(&simgrid::s4u::Comm::wait_any), + py::call_guard(), + "Block until the completion of any communication in the list and return the index of the terminated one."); /* Class Exec */ py::class_(m, "Exec", "Execution") diff --git a/src/s4u/s4u_Comm.cpp b/src/s4u/s4u_Comm.cpp index 32d11e9d20..6dca641353 100644 --- a/src/s4u/s4u_Comm.cpp +++ b/src/s4u/s4u_Comm.cpp @@ -39,43 +39,43 @@ Comm::~Comm() } } -int Comm::wait_any_for(const std::vector* comms, double timeout) +int Comm::wait_any_for(const std::vector& comms, double timeout) { - std::vector rcomms(comms->size()); - std::transform(begin(*comms), end(*comms), begin(rcomms), + std::vector rcomms(comms.size()); + std::transform(begin(comms), end(comms), begin(rcomms), [](const CommPtr& comm) { return static_cast(comm->pimpl_.get()); }); int changed_pos = simcall_comm_waitany(rcomms.data(), rcomms.size(), timeout); if (changed_pos != -1) - comms->at(changed_pos)->complete(State::FINISHED); + comms.at(changed_pos)->complete(State::FINISHED); return changed_pos; } -void Comm::wait_all(const std::vector* comms) +void Comm::wait_all(const std::vector& comms) { // TODO: this should be a simcall or something - for (auto& comm : *comms) + for (auto& comm : comms) comm->wait(); } -size_t Comm::wait_all_for(const std::vector* comms, double timeout) +size_t Comm::wait_all_for(const std::vector& comms, double timeout) { if (timeout < 0.0) { wait_all(comms); - return comms->size(); + return comms.size(); } double deadline = Engine::get_clock() + timeout; std::vector waited_comm(1, nullptr); - for (size_t i = 0; i < comms->size(); i++) { + for (size_t i = 0; i < comms.size(); i++) { double wait_timeout = std::max(0.0, deadline - Engine::get_clock()); - waited_comm[0] = (*comms)[i]; + waited_comm[0] = comms[i]; // Using wait_any_for() here (and not wait_for) because we don't want comms to be invalidated on timeout - if (wait_any_for(&waited_comm, wait_timeout) == -1) { + if (wait_any_for(waited_comm, wait_timeout) == -1) { XBT_DEBUG("Timeout (%g): i = %zu", wait_timeout, i); return i; } } - return comms->size(); + return comms.size(); } CommPtr Comm::set_rate(double rate) @@ -245,14 +245,14 @@ Comm* Comm::wait_for(double timeout) return this; } -int Comm::test_any(const std::vector* comms) +int Comm::test_any(const std::vector& comms) { - std::vector rcomms(comms->size()); - std::transform(begin(*comms), end(*comms), begin(rcomms), + std::vector rcomms(comms.size()); + std::transform(begin(comms), end(comms), begin(rcomms), [](const CommPtr& comm) { return static_cast(comm->pimpl_.get()); }); int changed_pos = simcall_comm_testany(rcomms.data(), rcomms.size()); if (changed_pos != -1) - comms->at(changed_pos)->complete(State::FINISHED); + comms.at(changed_pos)->complete(State::FINISHED); return changed_pos; } @@ -350,7 +350,7 @@ size_t sg_comm_wait_all_for(sg_comm_t* comms, size_t count, double timeout) for (size_t i = 0; i < count; i++) s4u_comms.emplace_back(comms[i], false); - size_t pos = simgrid::s4u::Comm::wait_all_for(&s4u_comms, timeout); + size_t pos = simgrid::s4u::Comm::wait_all_for(s4u_comms, timeout); for (size_t i = pos; i < count; i++) s4u_comms[i]->add_ref(); return pos; @@ -367,7 +367,7 @@ int sg_comm_wait_any_for(sg_comm_t* comms, size_t count, double timeout) for (unsigned int i = 0; i < count; i++) s4u_comms.emplace_back(comms[i], false); - int pos = simgrid::s4u::Comm::wait_any_for(&s4u_comms, timeout); + int pos = simgrid::s4u::Comm::wait_any_for(s4u_comms, timeout); for (unsigned i = 0; i < count; i++) { if (pos != -1 && static_cast(pos) != i) s4u_comms[i]->add_ref(); diff --git a/src/s4u/s4u_Exec.cpp b/src/s4u/s4u_Exec.cpp index 24e0111c3a..5cd21a2d6c 100644 --- a/src/s4u/s4u_Exec.cpp +++ b/src/s4u/s4u_Exec.cpp @@ -53,10 +53,10 @@ Exec* Exec::start() return this; } -int Exec::wait_any_for(std::vector* execs, double timeout) +int Exec::wait_any_for(const std::vector& execs, double timeout) { - std::vector rexecs(execs->size()); - std::transform(begin(*execs), end(*execs), begin(rexecs), + std::vector rexecs(execs.size()); + std::transform(begin(execs), end(execs), begin(rexecs), [](const ExecPtr& exec) { return static_cast(exec->pimpl_.get()); }); kernel::actor::ActorImpl* issuer = kernel::actor::ActorImpl::self(); @@ -67,7 +67,7 @@ int Exec::wait_any_for(std::vector* execs, double timeout) }, &observer); if (changed_pos != -1) - execs->at(changed_pos)->complete(State::FINISHED); + execs.at(changed_pos)->complete(State::FINISHED); return changed_pos; } @@ -321,7 +321,7 @@ int sg_exec_wait_any_for(sg_exec_t* execs, size_t count, double timeout) for (unsigned int i = 0; i < count; i++) s4u_execs.emplace_back(execs[i], false); - int pos = simgrid::s4u::Exec::wait_any_for(&s4u_execs, timeout); + int pos = simgrid::s4u::Exec::wait_any_for(s4u_execs, timeout); for (unsigned i = 0; i < count; i++) { if (pos != -1 && static_cast(pos) != i) s4u_execs[i]->add_ref(); diff --git a/src/s4u/s4u_Io.cpp b/src/s4u/s4u_Io.cpp index ef4846c583..a4aba5b2e0 100644 --- a/src/s4u/s4u_Io.cpp +++ b/src/s4u/s4u_Io.cpp @@ -46,10 +46,10 @@ Io* Io::start() return this; } -int Io::wait_any_for(std::vector* ios, double timeout) +int Io::wait_any_for(const std::vector& ios, double timeout) { - std::vector rios(ios->size()); - std::transform(begin(*ios), end(*ios), begin(rios), + std::vector rios(ios.size()); + std::transform(begin(ios), end(ios), begin(rios), [](const IoPtr& io) { return static_cast(io->pimpl_.get()); }); kernel::actor::ActorImpl* issuer = kernel::actor::ActorImpl::self(); @@ -60,7 +60,7 @@ int Io::wait_any_for(std::vector* ios, double timeout) }, &observer); if (changed_pos != -1) - ios->at(changed_pos)->complete(State::FINISHED); + ios.at(changed_pos)->complete(State::FINISHED); return changed_pos; } diff --git a/teshsuite/s4u/activity-lifecycle/testing_comm.cpp b/teshsuite/s4u/activity-lifecycle/testing_comm.cpp index 9205f32e6a..87b7af7c30 100644 --- a/teshsuite/s4u/activity-lifecycle/testing_comm.cpp +++ b/teshsuite/s4u/activity-lifecycle/testing_comm.cpp @@ -272,7 +272,7 @@ TEST_CASE("Activity lifecycle: comm activities") int* data; simgrid::s4u::CommPtr comm = simgrid::s4u::Mailbox::by_name("mb")->get_async(&data); std::vector pending_comms = {comm}; - REQUIRE_NETWORK_FAILURE(simgrid::s4u::Comm::wait_any(&pending_comms)); + REQUIRE_NETWORK_FAILURE(simgrid::s4u::Comm::wait_any(pending_comms)); }); simgrid::s4u::ActorPtr sender = simgrid::s4u::Actor::create("sender", all_hosts[2], []() { diff --git a/teshsuite/s4u/activity-lifecycle/testing_test-wait.cpp b/teshsuite/s4u/activity-lifecycle/testing_test-wait.cpp index 2b8f82fe20..e47abd6155 100644 --- a/teshsuite/s4u/activity-lifecycle/testing_test-wait.cpp +++ b/teshsuite/s4u/activity-lifecycle/testing_test-wait.cpp @@ -62,7 +62,7 @@ template bool tester_wait_any(const Activity& try { std::vector activities = {activity}; XBT_DEBUG("calling wait_any_for(%f)", duration); - int index = Activity::element_type::wait_any_for(&activities, duration); + int index = Activity::element_type::wait_any_for(activities, duration); if (index == -1) { XBT_DEBUG("wait_any_for() timed out"); INFO("wait_any_for() timeout should expire at expected date: " << timeout); diff --git a/teshsuite/s4u/seal-platform/seal-platform.cpp b/teshsuite/s4u/seal-platform/seal-platform.cpp index 325d32d5ff..512362d64f 100644 --- a/teshsuite/s4u/seal-platform/seal-platform.cpp +++ b/teshsuite/s4u/seal-platform/seal-platform.cpp @@ -35,7 +35,7 @@ public: XBT_INFO("Done dispatching all messages"); /* Now that all message exchanges were initiated, wait for their completion in one single call */ - sg4::Comm::wait_all(&pending_comms); + sg4::Comm::wait_all(pending_comms); XBT_INFO("Goodbye now!"); } diff --git a/teshsuite/s4u/wait-all-for/wait-all-for.cpp b/teshsuite/s4u/wait-all-for/wait-all-for.cpp index 7c7453d52b..f8ca85dc56 100644 --- a/teshsuite/s4u/wait-all-for/wait-all-for.cpp +++ b/teshsuite/s4u/wait-all-for/wait-all-for.cpp @@ -31,7 +31,7 @@ static void worker() std::vector comms = {put1, put2, get1, get2}; while (not comms.empty()) { - size_t index = simgrid::s4u::Comm::wait_all_for(&comms, 0.5); + size_t index = simgrid::s4u::Comm::wait_all_for(comms, 0.5); if (index < comms.size()) XBT_INFO("wait_all_for: Timeout reached"); XBT_INFO("wait_all_for: %zu comms finished (#comms=%zu)", index, comms.size()); diff --git a/teshsuite/s4u/wait-any-for/wait-any-for.cpp b/teshsuite/s4u/wait-any-for/wait-any-for.cpp index 3c4200c06c..c25455d66a 100644 --- a/teshsuite/s4u/wait-any-for/wait-any-for.cpp +++ b/teshsuite/s4u/wait-any-for/wait-any-for.cpp @@ -31,7 +31,7 @@ static void worker() std::vector comms = {put1, put2, get1, get2}; while (not comms.empty()) { - int index = simgrid::s4u::Comm::wait_any_for(&comms, 0.5); + int index = simgrid::s4u::Comm::wait_any_for(comms, 0.5); if (index < 0) XBT_INFO("wait_any_for: Timeout reached"); else {