-#include "simgrid/s4u/comm.hpp"
-
-XBT_LOG_NEW_DEFAULT_SUBCATEGORY(s4u_comm,s4u_async,"S4U asynchronous communications");
-using namespace simgrid;
-
-s4u::Comm::~Comm() {
-
-}
-
-s4u::Comm &s4u::Comm::send_init(s4u::Actor *sender, s4u::Mailbox &chan) {
- s4u::Comm *res = new s4u::Comm();
- res->sender_ = sender;
- res->mailbox_ = &chan;
-
- return *res;
-}
-s4u::Comm &s4u::Comm::recv_init(s4u::Actor *receiver, s4u::Mailbox &chan) {
- s4u::Comm *res = new s4u::Comm();
- res->receiver_ = receiver;
- res->mailbox_ = &chan;
-
- return *res;
+#include "simgrid/s4u/Comm.hpp"
+#include "simgrid/s4u/Mailbox.hpp"
+
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(s4u_comm,s4u_activity,"S4U asynchronous communications");
+
+namespace simgrid {
+namespace s4u {
+Comm::~Comm()
+{
+ if (state_ == started && not detached_ && (pimpl_ == nullptr || pimpl_->state == SIMIX_RUNNING)) {
+ XBT_INFO("Comm %p freed before its completion. Detached: %d, State: %d", this, detached_, state_);
+ if (pimpl_ != nullptr)
+ XBT_INFO("pimpl_->state: %d", pimpl_->state);
+ else
+ XBT_INFO("pimpl_ is null");
+ xbt_backtrace_display_current();
+ }