xbt_backtrace_display_current();
}
if (pimpl_)
- pimpl_->unref();
+ SIMIX_comm_unref(pimpl_);
}
s4u::CommPtr Comm::send_init(s4u::MailboxPtr chan)
} else {
xbt_die("Cannot start a communication before specifying whether we are the sender or the receiver");
}
- while (refcount_ > 1) { // Pass all the refcounts we had to the underlying pimpl since we are delegating the
- // refcounting to it afterward
- refcount_--;
- pimpl_->ref();
- }
state_ = started;
}
void Comm::wait() {
void intrusive_ptr_release(simgrid::s4u::Comm* c)
{
- if (c->pimpl_ != nullptr) {
- if (c->pimpl_->unref()) {
- c->pimpl_ = nullptr;
- delete c;
- }
- } else if (c->refcount_.fetch_sub(1, std::memory_order_release) == 1) {
+ if (c->refcount_.fetch_sub(1, std::memory_order_release) == 1) {
std::atomic_thread_fence(std::memory_order_acquire);
delete c;
}
}
void intrusive_ptr_add_ref(simgrid::s4u::Comm* c)
{
- if (c->pimpl_ != nullptr) {
- c->pimpl_->ref();
- } else {
- c->refcount_.fetch_add(1, std::memory_order_relaxed);
- }
+ c->refcount_.fetch_add(1, std::memory_order_relaxed);
}
}
} // namespaces
XBT_DEBUG("Found a matching communication synchro %p", comm);
if (remove_matching)
deque->erase(it);
- comm = static_cast<simgrid::kernel::activity::CommImpl*>(SIMIX_comm_ref(comm));
+ SIMIX_comm_ref(comm);
#if SIMGRID_HAVE_MC
comm->mbox_cpy = comm->mbox;
#endif
simgrid::s4u::Host* sender = comm->src_proc->host;
simgrid::s4u::Host* receiver = comm->dst_proc->host;
- XBT_DEBUG("Starting communication %p from '%s' to '%s'", synchro, sender->cname(), receiver->cname());
-
comm->surf_comm = surf_network_model->communicate(sender, receiver, comm->task_size, comm->rate);
comm->surf_comm->setData(synchro);
comm->state = SIMIX_RUNNING;
+ XBT_DEBUG("Starting communication %p from '%s' to '%s' (surf_action: %p)", synchro, sender->cname(),
+ receiver->cname(), comm->surf_comm);
+
/* If a link is failed, detect it immediately */
if (comm->surf_comm->getState() == simgrid::surf::Action::State::failed) {
XBT_DEBUG("Communication from '%s' to '%s' failed to start because of a link failure", sender->cname(),
/* If the synchro is still in a rendez-vous point then remove from it */
if (comm->mbox)
- comm->mbox->remove(synchro);
+ comm->mbox->remove(comm);
XBT_DEBUG("SIMIX_comm_finish: synchro state = %d", (int)synchro->state);
-/* Copyright (c) 2013-2015. The SimGrid Team.
- * All rights reserved. */
+/* Copyright (c) 2013-2017. 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. */