From: Frederic Suter Date: Wed, 20 Feb 2019 16:04:52 +0000 (+0100) Subject: save a cast X-Git-Tag: v3_22~281 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/4b04faa98dd6b4d52c3383a177e810f8e450fd48?hp=0bc609260a603d6d396101c30ad4dd9c845e6dfd save a cast --- diff --git a/include/simgrid/s4u/Mailbox.hpp b/include/simgrid/s4u/Mailbox.hpp index b0bac97834..c009267909 100644 --- a/include/simgrid/s4u/Mailbox.hpp +++ b/include/simgrid/s4u/Mailbox.hpp @@ -50,7 +50,7 @@ public: bool ready(); /** Gets the first element in the queue (without dequeuing it), or nullptr if none is there */ - smx_activity_t front(); + kernel::activity::CommImplPtr front(); /** Declare that the specified actor is a permanent receiver on that mailbox * diff --git a/src/msg/msg_gos.cpp b/src/msg/msg_gos.cpp index 6fa750c748..877cfcfab2 100644 --- a/src/msg/msg_gos.cpp +++ b/src/msg/msg_gos.cpp @@ -792,14 +792,9 @@ msg_error_t MSG_task_send_with_timeout_bounded(msg_task_t task, const char *alia */ int MSG_task_listen_from(const char *alias) { - simgrid::s4u::MailboxPtr mbox = simgrid::s4u::Mailbox::by_name(alias); - simgrid::kernel::activity::CommImplPtr comm = - boost::static_pointer_cast(mbox->front()); + simgrid::kernel::activity::CommImplPtr comm = simgrid::s4u::Mailbox::by_name(alias)->front(); - if (not comm) - return -1; - - return MSG_process_get_PID(static_cast(comm->src_buff_)->simdata->sender); + return comm ? MSG_process_get_PID(static_cast(comm->src_buff_)->simdata->sender) : -1; } /** diff --git a/src/s4u/s4u_Mailbox.cpp b/src/s4u/s4u_Mailbox.cpp index 704d4680e6..52a0874540 100644 --- a/src/s4u/s4u_Mailbox.cpp +++ b/src/s4u/s4u_Mailbox.cpp @@ -56,7 +56,7 @@ bool Mailbox::ready() return comm_ready; } -smx_activity_t Mailbox::front() +kernel::activity::CommImplPtr Mailbox::front() { return pimpl_->comm_queue_.empty() ? nullptr : pimpl_->comm_queue_.front(); }