- /** Creates (but don't start) an async send to the mailbox @p dest */
- static CommPtr send_init(MailboxPtr dest);
- /** Creates and start an async send to the mailbox @p dest */
- static CommPtr send_async(MailboxPtr dest, void* data, int simulatedByteAmount);
- /** Creates (but don't start) an async recv onto the mailbox @p from */
- static CommPtr recv_init(MailboxPtr from);
- /** Creates and start an async recv to the mailbox @p from */
- static CommPtr recv_async(MailboxPtr from, void** data);
- /** Creates and start a detached send to the mailbox @p dest
- * TODO: make it possible to detach an already created comm */
- static void send_detached(MailboxPtr dest, void* data, int simulatedSize);
-
- void start() override;
- void wait() override;
- void wait(double timeout) override;
+
+ /*! take a vector s4u::CommPtr and return when all of them is finished. */
+ static void wait_all(std::vector<CommPtr> * comms)
+ {
+ // TODO: this should be a simcall or something
+ // TODO: we are missing a version with timeout
+ for (CommPtr comm : *comms) {
+ comm->wait();
+ }
+ }
+ /*! take a vector s4u::CommPtr and return the rank of the first finished one (or -1 if none is done). */
+ static int test_any(std::vector<CommPtr> * comms);
+
+ Activity* start() override;
+ Activity* wait() override;
+ Activity* wait(double timeout) override;
+
+ /** Start the comm, and ignore its result. It can be completely forgotten after that. */
+ Activity* detach();
+ /** Start the comm, and ignore its result. It can be completely forgotten after that. */
+ Activity* detach(void (*cleanFunction)(void*))
+ {
+ cleanFunction_ = cleanFunction;
+ return detach();
+ }