-/* Copyright (c) 2018-2020. The SimGrid Team. All rights reserved. */
+/* Copyright (c) 2018-2021. 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. */
params[i - 1] = py::cast(args[i]);
py::object res = fun_or_class(*params);
-
/* If I was passed a class, I just built an instance, so I need to call it now */
if (py::isinstance<py::function>(res))
res();
py_context.reset();
if (ffk) {
XBT_VERB("Actor killed");
- /* Forward that ForcefulKill exception */
- simgrid::ForcefulKillException::do_throw();
+ simgrid::ForcefulKillException::do_throw(); // Forward that ForcefulKill exception
}
throw;
}
.def(
"get",
[](Mailbox* self) {
- py::object data = pybind11::reinterpret_steal<py::object>(static_cast<PyObject*>(self->get()));
+ py::object data = pybind11::reinterpret_steal<py::object>(self->get<PyObject>());
// data.dec_ref(); // FIXME: why does it break python-actor-create?
return data;
},
"Test whether the communication is terminated.")
.def("wait", &simgrid::s4u::Comm::wait, py::call_guard<GilScopedRelease>(),
"Block until the completion of that communication.")
- .def("wait_all", &simgrid::s4u::Comm::wait_all, py::call_guard<GilScopedRelease>(),
- "Block until the completion of all communications in the list.")
- .def("wait_any", &simgrid::s4u::Comm::wait_any, py::call_guard<GilScopedRelease>(),
- "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<const std::vector<simgrid::s4u::CommPtr>&>(&simgrid::s4u::Comm::wait_all),
+ py::call_guard<GilScopedRelease>(), "Block until the completion of all communications in the list.")
+ .def_static(
+ "wait_any", py::overload_cast<const std::vector<simgrid::s4u::CommPtr>&>(&simgrid::s4u::Comm::wait_any),
+ py::call_guard<GilScopedRelease>(),
+ "Block until the completion of any communication in the list and return the index of the terminated one.");
/* Class Exec */
py::class_<simgrid::s4u::Exec, simgrid::s4u::ExecPtr>(m, "Exec", "Execution")
py_context.reset();
if (ffk) {
XBT_VERB("Actor killed");
- /* Forward that ForcefulKill exception */
- simgrid::ForcefulKillException::do_throw();
+ simgrid::ForcefulKillException::do_throw(); // Forward that ForcefulKill exception
}
throw;
}
.def("is_daemon", &Actor::is_daemon,
"Returns True if that actor is a daemon and will be terminated automatically when the last non-daemon actor "
"terminates.")
- .def("join", py::overload_cast<double>(&Actor::join), py::call_guard<GilScopedRelease>(),
+ .def("join", py::overload_cast<double>(&Actor::join, py::const_), py::call_guard<GilScopedRelease>(),
"Wait for the actor to finish (more info in the C++ documentation).", py::arg("timeout"))
.def("kill", &Actor::kill, py::call_guard<GilScopedRelease>(), "Kill that actor")
.def("kill_all", &Actor::kill_all, py::call_guard<GilScopedRelease>(), "Kill all actors but the caller.")