From: Martin Quinson Date: Sat, 10 Dec 2016 16:50:02 +0000 (+0100) Subject: Detect and diagnose a possible user error X-Git-Tag: v3_14~84 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/b8e92a8fe1dadd3c279b3a790995dd3a1c3f2c03 Detect and diagnose a possible user error --- diff --git a/src/msg/msg_gos.cpp b/src/msg/msg_gos.cpp index ba4b478793..0abc0ce7b4 100644 --- a/src/msg/msg_gos.cpp +++ b/src/msg/msg_gos.cpp @@ -574,6 +574,14 @@ int MSG_comm_testany(xbt_dynar_t comms) */ void MSG_comm_destroy(msg_comm_t comm) { + /* Diagnose a possible user error: destroying a comm that is not done yet, and not detached either */ + if ((comm->s_comm->state == SIMIX_READY || comm->s_comm->state == SIMIX_RUNNING) + && (!static_cast(comm->s_comm)->detached)) + XBT_WARN("You are destroying a communication that is not done yet but %s. " + "This will lead to issues when the other side continues this communication. " + "Are you looking for MSG_task_dsend()?", + (comm->s_comm->state == SIMIX_READY ? "ready" : "running")); + xbt_free(comm); }