--- /dev/null
+/* Copyright (c) 2018-2020. 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. */
+
+#ifndef INCLUDE_SIMGRID_COMM_H_
+#define INCLUDE_SIMGRID_COMM_H_
+
+#include <simgrid/forward.h>
+#include <xbt/dynar.h>
+
+/* C interface */
+SG_BEGIN_DECL
+
+XBT_PUBLIC int sg_comm_wait_any_for(const xbt_dynar_t comms, double timeout);
+
+SG_END_DECL
+
+#endif /* INCLUDE_SIMGRID_COMM_H_ */
#include "simgrid/s4u/Comm.hpp"
#include "simgrid/s4u/Mailbox.hpp"
+#include <simgrid/comm.h>
+
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(s4u_comm, s4u_activity, "S4U asynchronous communications");
namespace simgrid {
} // namespace s4u
} // namespace simgrid
+/* **************************** Public C interface *************************** */
+int sg_comm_wait_any_for(const xbt_dynar_t comms, double timeout)
+{
+ std::vector<simgrid::s4u::CommPtr> s4u_comms;
+ unsigned int i;
+ sg_comm_t comm;
+ xbt_dynar_foreach (comms, i, comm) {
+ s4u_comms.push_back(comm);
+ }
+ return simgrid::s4u::Comm::wait_any_for(&s4u_comms, timeout);
+}