From: Arnaud Giersch Date: Mon, 12 Apr 2021 08:32:34 +0000 (+0200) Subject: Simcall COMM_TEST is not blocking. X-Git-Tag: v3.28~455^2~87 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/97f3bcce4b5fbce4b3154698cd2d0b1284dd6726 Simcall COMM_TEST is not blocking. --- diff --git a/src/kernel/activity/CommImpl.cpp b/src/kernel/activity/CommImpl.cpp index 18baf18450..95f7c05849 100644 --- a/src/kernel/activity/CommImpl.cpp +++ b/src/kernel/activity/CommImpl.cpp @@ -223,7 +223,7 @@ void simcall_HANDLER_comm_wait(smx_simcall_t simcall, simgrid::kernel::activity: } } -void simcall_HANDLER_comm_test(smx_simcall_t simcall, simgrid::kernel::activity::CommImpl* comm) +bool simcall_HANDLER_comm_test(smx_simcall_t simcall, simgrid::kernel::activity::CommImpl* comm) { if ((MC_is_active() || MC_record_replay_is_active()) && comm->src_actor_ && comm->dst_actor_) comm->state_ = simgrid::kernel::activity::State::DONE; @@ -231,13 +231,9 @@ void simcall_HANDLER_comm_test(smx_simcall_t simcall, simgrid::kernel::activity: bool res = comm->state_ != simgrid::kernel::activity::State::WAITING && comm->state_ != simgrid::kernel::activity::State::RUNNING; - simcall_comm_test__set__result(simcall, res); - if (res) { - comm->simcalls_.push_back(simcall); + if (res) comm->finish(); - } else { - simcall->issuer_->simcall_answer(); - } + return res; } void simcall_HANDLER_comm_testany(smx_simcall_t simcall, simgrid::kernel::activity::CommImpl* comms[], size_t count) diff --git a/src/simix/popping_accessors.hpp b/src/simix/popping_accessors.hpp index 39ecf1d576..0f878b097e 100644 --- a/src/simix/popping_accessors.hpp +++ b/src/simix/popping_accessors.hpp @@ -667,7 +667,7 @@ XBT_PRIVATE void simcall_HANDLER_comm_recv(smx_simcall_t simcall, smx_actor_t re XBT_PRIVATE boost::intrusive_ptr simcall_HANDLER_comm_irecv(smx_simcall_t simcall, smx_actor_t receiver, smx_mailbox_t mbox, unsigned char* dst_buff, size_t* dst_buff_size, simix_match_func_t match_fun, simix_copy_data_func_t copy_data_fun, void* data, double rate); XBT_PRIVATE void simcall_HANDLER_comm_send(smx_simcall_t simcall, smx_actor_t sender, smx_mailbox_t mbox, double task_size, double rate, unsigned char* src_buff, size_t src_buff_size, simix_match_func_t match_fun, simix_copy_data_func_t copy_data_fun, void* data, double timeout); XBT_PRIVATE boost::intrusive_ptr simcall_HANDLER_comm_isend(smx_simcall_t simcall, smx_actor_t sender, smx_mailbox_t mbox, double task_size, double rate, unsigned char* src_buff, size_t src_buff_size, simix_match_func_t match_fun, simix_clean_func_t clean_fun, simix_copy_data_func_t copy_data_fun, void* data, bool detached); -XBT_PRIVATE void simcall_HANDLER_comm_test(smx_simcall_t simcall, simgrid::kernel::activity::CommImpl* comm); +XBT_PRIVATE bool simcall_HANDLER_comm_test(smx_simcall_t simcall, simgrid::kernel::activity::CommImpl* comm); XBT_PRIVATE void simcall_HANDLER_comm_testany(smx_simcall_t simcall, simgrid::kernel::activity::CommImpl** comms, size_t count); XBT_PRIVATE void simcall_HANDLER_comm_waitany(smx_simcall_t simcall, simgrid::kernel::activity::CommImpl** comms, size_t count, double timeout); XBT_PRIVATE void simcall_HANDLER_comm_wait(smx_simcall_t simcall, simgrid::kernel::activity::CommImpl* comm, double timeout); diff --git a/src/simix/popping_generated.cpp b/src/simix/popping_generated.cpp index fc87f65dd5..36c4db8dac 100644 --- a/src/simix/popping_generated.cpp +++ b/src/simix/popping_generated.cpp @@ -74,7 +74,8 @@ void simgrid::kernel::actor::ActorImpl::simcall_handle(int times_considered) break; case Simcall::COMM_TEST: - simcall_HANDLER_comm_test(&simcall_, simgrid::simix::unmarshal(simcall_.args_[0])); + simgrid::simix::marshal(simcall_.result_, simcall_HANDLER_comm_test(&simcall_, simgrid::simix::unmarshal(simcall_.args_[0]))); + simcall_answer(); break; case Simcall::COMM_TESTANY: diff --git a/src/simix/simcalls.in b/src/simix/simcalls.in index 405056cb12..e745724fad 100644 --- a/src/simix/simcalls.in +++ b/src/simix/simcalls.in @@ -39,7 +39,7 @@ void comm_recv(smx_actor_t receiver, smx_mailbox_t mbox, unsigned char boost::intrusive_ptr comm_irecv(smx_actor_t receiver, smx_mailbox_t mbox, unsigned char* dst_buff, size_t* dst_buff_size, simix_match_func_t match_fun, simix_copy_data_func_t copy_data_fun, void* data, double rate); void comm_send(smx_actor_t sender, smx_mailbox_t mbox, double task_size, double rate, unsigned char* src_buff, size_t src_buff_size, simix_match_func_t match_fun, simix_copy_data_func_t copy_data_fun, void* data, double timeout) [[block]]; boost::intrusive_ptr comm_isend(smx_actor_t sender, smx_mailbox_t mbox, double task_size, double rate, unsigned char* src_buff, size_t src_buff_size, simix_match_func_t match_fun, simix_clean_func_t clean_fun, simix_copy_data_func_t copy_data_fun, void* data, bool detached); -bool comm_test(simgrid::kernel::activity::CommImpl* comm) [[block]]; +bool comm_test(simgrid::kernel::activity::CommImpl* comm); int comm_testany(simgrid::kernel::activity::CommImpl** comms, size_t count) [[block]]; int comm_waitany(simgrid::kernel::activity::CommImpl** comms, size_t count, double timeout) [[block]]; void comm_wait(simgrid::kernel::activity::CommImpl* comm, double timeout) [[block]];