- static int wait_any_for(std::vector<CommPtr> * comms_in, double timeout)
- {
- // Map to dynar<Synchro*>:
- xbt_dynar_t comms = xbt_dynar_new(sizeof(simgrid::kernel::activity::ActivityImpl*), [](void*ptr){
- intrusive_ptr_release(*(simgrid::kernel::activity::ActivityImpl**)ptr);
- });
- for (auto comm : *comms_in) {
- if (comm->state_ == inited)
- comm->start();
- xbt_assert(comm->state_ == started);
- simgrid::kernel::activity::ActivityImpl* ptr = comm->pimpl_.get();
- intrusive_ptr_add_ref(ptr);
- xbt_dynar_push_as(comms, simgrid::kernel::activity::ActivityImpl*, ptr);
- }
- // Call the underlying simcall:
- int idx = simcall_comm_waitany(comms, timeout);
- xbt_dynar_free(&comms);
- return idx;
- }
- /** 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);
-
- void start() override;
- void wait() override;
- void wait(double timeout) override;