X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/c2621f1ff5dd1e2c7093b20aaeb0540b0c5d099f..b372d23d3d8818b4547ef207f43b45709298a002:/src/s4u/s4u_Comm.cpp diff --git a/src/s4u/s4u_Comm.cpp b/src/s4u/s4u_Comm.cpp index 7e9d64857b..55a79e5aa7 100644 --- a/src/s4u/s4u_Comm.cpp +++ b/src/s4u/s4u_Comm.cpp @@ -16,9 +16,8 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(s4u_comm, s4u_activity, "S4U asynchronous commun namespace simgrid { namespace s4u { -xbt::signal Comm::on_sender_start; -xbt::signal Comm::on_receiver_start; -xbt::signal Comm::on_completion; +xbt::signal Comm::on_start; +xbt::signal Comm::on_completion; Comm::~Comm() { @@ -113,25 +112,18 @@ CommPtr Comm::set_dst_data(void** buff, size_t size) return this; } -CommPtr Comm::set_tracing_category(const std::string& category) -{ - xbt_assert(state_ == State::INITED, "Cannot change the tracing category of an exec after its start"); - tracing_category_ = category; - return this; -} - Comm* Comm::start() { xbt_assert(get_state() == State::INITED || get_state() == State::STARTING, "You cannot use %s() once your communication started (not implemented)", __FUNCTION__); if (src_buff_ != nullptr) { // Sender side - on_sender_start(*Actor::self()); + on_start(*this, true /* is_sender*/); pimpl_ = simcall_comm_isend(sender_, mailbox_->get_impl(), remains_, rate_, src_buff_, src_buff_size_, match_fun_, clean_fun_, copy_data_function_, get_user_data(), detached_); } else if (dst_buff_ != nullptr) { // Receiver side xbt_assert(not detached_, "Receive cannot be detached"); - on_receiver_start(*Actor::self()); + on_start(*this, false /*is_sender*/); pimpl_ = simcall_comm_irecv(receiver_, mailbox_->get_impl(), dst_buff_, &dst_buff_size_, match_fun_, copy_data_function_, get_user_data(), rate_); @@ -167,12 +159,12 @@ Comm* Comm::wait_for(double timeout) case State::INITED: case State::STARTING: // It's not started yet. Do it in one simcall if (src_buff_ != nullptr) { - on_sender_start(*Actor::self()); + on_start(*this, true /*is_sender*/); simcall_comm_send(sender_, mailbox_->get_impl(), remains_, rate_, src_buff_, src_buff_size_, match_fun_, copy_data_function_, get_user_data(), timeout); } else { // Receiver - on_receiver_start(*Actor::self()); + on_start(*this, false /*is_sender*/); simcall_comm_recv(receiver_, mailbox_->get_impl(), dst_buff_, &dst_buff_size_, match_fun_, copy_data_function_, get_user_data(), timeout, rate_); } @@ -182,7 +174,6 @@ Comm* Comm::wait_for(double timeout) case State::STARTED: simcall_comm_wait(get_impl(), timeout); - on_completion(*Actor::self()); state_ = State::FINISHED; this->release_dependencies(); break; @@ -193,6 +184,7 @@ Comm* Comm::wait_for(double timeout) default: THROW_IMPOSSIBLE; } + on_completion(*this); return this; }