X-Git-Url: http://bilbo.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/051812e67ee3e1d24c8fad3f03b91627ba2821f7..716c8e0b373bed43c35af2b35514f0b7a69b08a5:/src/kernel/activity/CommImpl.cpp diff --git a/src/kernel/activity/CommImpl.cpp b/src/kernel/activity/CommImpl.cpp index 5615d87cfc..25a76617e4 100644 --- a/src/kernel/activity/CommImpl.cpp +++ b/src/kernel/activity/CommImpl.cpp @@ -37,7 +37,9 @@ CommImpl::CommImpl() std::function CommImpl::copy_data_callback_ = [](kernel::activity::CommImpl* comm, void* buff, size_t buff_size) { xbt_assert((buff_size == sizeof(void*)), "Cannot copy %zu bytes: must be sizeof(void*)", buff_size); - *(void**)(comm->dst_buff_) = buff; + if (comm->dst_buff_ != nullptr) // get_async provided a buffer + *(void**)(comm->dst_buff_) = buff; + comm->payload_ = buff; // Setup what will be retrieved by s4u::Comm::get_payload() }; void CommImpl::set_copy_data_callback(const std::function& callback) @@ -192,7 +194,7 @@ void CommImpl::copy_data() { size_t buff_size = src_buff_size_; /* If there is no data to copy then return */ - if (not src_buff_ || not dst_buff_ || copied_) + if (not src_buff_ || not dst_buff_size_ || copied_) return; XBT_DEBUG("Copying comm %p data from %s (%p) -> %s (%p) (%zu bytes)", this, @@ -486,8 +488,8 @@ void CommImpl::finish() if (get_iface()) { const auto& piface = static_cast(*get_iface()); set_iface(nullptr); // reset iface to protect against multiple trigger of the on_completion signals - s4u::Comm::on_completion(piface); - piface.on_this_completion(piface); + piface.fire_on_completion_for_real(); + piface.fire_on_this_completion_for_real(); } /* Update synchro state */