S4U:
- New class ActivitySet to ease wait_any()/test_any()/wait_all()
+ - Deprecate {Comm,Io,Exec}::{wait_any,wait_all,test_any} and friends
- New function NetZone::add_route(host1, host2, links) when you don't need gateways
Also add a variant with s4u::Link, when you don't want to specify the directions
on symmetric routes.
- Mailbox::get_async() does not return a pair anymore. Use comm.get_payload() instead.
- Comm::waitall() is gone. Please use ActivitySet() instead.
- Comm::waitallfor() is gone too. Its semantic was unclear on timeout anyway.
+ - Io::waitany() and waitanyfor() are gone. Please use ActivitySet() instead.
----------------------------------------------------------------------------
#ifndef DOXYGEN
static ssize_t deprecated_wait_any_for(const std::vector<ExecPtr>& execs,
double timeout); // XBT_ATTRIB_DEPRECATED_v339
- /*! \static 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. */
+
XBT_ATTRIB_DEPRECATED_v339("Please use ActivitySet instead") static ssize_t
wait_any(const std::vector<ExecPtr>& execs)
{
return deprecated_wait_any_for(execs, -1);
}
- /*! \static Same as wait_any, but with a timeout. If the timeout occurs, parameter last is returned.*/
XBT_ATTRIB_DEPRECATED_v339("Please use ActivitySet instead") static ssize_t
wait_any_for(const std::vector<ExecPtr>& execs, double timeout)
{
explicit Io(kernel::activity::IoImplPtr pimpl);
Io* do_start() override;
+ static ssize_t deprecated_wait_any_for(const std::vector<IoPtr>& ios, double timeout);
+
public:
enum class OpType { READ, WRITE };
/*! \static Initiate the creation of an I/O. Setters have to be called afterwards */
static IoPtr init();
- /*! \static 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 ssize_t wait_any(const std::vector<IoPtr>& ios) { return wait_any_for(ios, -1); }
- /*! \static Same as wait_any, but with a timeout. If the timeout occurs, parameter last is returned.*/
- static ssize_t wait_any_for(const std::vector<IoPtr>& ios, double timeout);
+#ifndef DOXYGEN
+ XBT_ATTRIB_DEPRECATED_v339("Please use ActivitySet instead")
+ static ssize_t wait_any(const std::vector<IoPtr>& ios) { return deprecated_wait_any_for(ios, -1); }
+ XBT_ATTRIB_DEPRECATED_v339("Please use ActivitySet instead")
+ static ssize_t wait_any_for(const std::vector<IoPtr>& ios, double timeout) {
+ return deprecated_wait_any_for(ios, timeout);
+ }
+#endif
double get_remaining() const override;
sg_size_t get_performed_ioops() const;
.def("test", &simgrid::s4u::Io::test, py::call_guard<py::gil_scoped_release>(),
"Test whether the I/O is terminated.")
.def("wait", &simgrid::s4u::Io::wait, py::call_guard<py::gil_scoped_release>(),
- "Block until the completion of that I/O operation")
- .def_static(
- "wait_any_for", &simgrid::s4u::Io::wait_any_for, py::call_guard<py::gil_scoped_release>(),
- "Block until the completion of any I/O in the list (or timeout) and return the index of the terminated one.")
- .def_static("wait_any", &simgrid::s4u::Io::wait_any, py::call_guard<py::gil_scoped_release>(),
- "Block until the completion of any I/O in the list and return the index of the terminated one.");
+ "Block until the completion of that I/O operation");
/* Class Exec */
py::class_<simgrid::s4u::Exec, simgrid::s4u::ExecPtr, Activity>(m, "Exec",
/* 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. */
+#include <simgrid/s4u/ActivitySet.hpp>
#include <simgrid/s4u/Disk.hpp>
#include <simgrid/s4u/Io.hpp>
#include <xbt/log.h>
return this;
}
-ssize_t Io::wait_any_for(const std::vector<IoPtr>& ios, double timeout)
+ssize_t Io::deprecated_wait_any_for(const std::vector<IoPtr>& ios, double timeout)
{
- std::vector<ActivityPtr> activities;
+ ActivitySet set;
for (const auto& io : ios)
- activities.push_back(boost::dynamic_pointer_cast<Activity>(io));
- return Activity::wait_any_for(activities, timeout);
+ set.push(boost::dynamic_pointer_cast<Activity>(io));
+
+ auto* ret = set.wait_any_for(timeout).get();
+ for (size_t i = 0; i < ios.size(); i++)
+ if (ios[i].get() == ret)
+ return i;
+
+ return -1;
}
IoPtr Io::set_disk(const_sg_disk_t disk)