Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
handle (badly) the timeout exception in wait_for()
[simgrid.git] / src / s4u / s4u_Comm.cpp
index c2dc1f13e96bf921d2778f563c9250fa378a43c6..bf135b4d0489d179f4ab36bc52a18798c4b7f4a5 100644 (file)
@@ -257,7 +257,16 @@ Actor* Comm::get_sender() const
 /* **************************** Public C interface *************************** */
 int sg_comm_test(sg_comm_t comm)
 {
-  return comm->test();
+  bool finished = comm->test();
+  if (finished)
+    comm->unref();
+  return finished;
+}
+
+void sg_comm_wait(sg_comm_t comm)
+{
+  comm->wait_for(-1);
+  comm->unref();
 }
 
 void sg_comm_wait_all(sg_comm_t* comms, size_t count)