{
comm->mbox = this;
this->comm_queue_.push_back(std::move(comm));
}
/** @brief Removes a communication activity from a mailbox
{
comm->mbox = this;
this->comm_queue_.push_back(std::move(comm));
}
/** @brief Removes a communication activity from a mailbox
xbt_assert(comm->mbox == this, "Comm %p is in mailbox %s, not mailbox %s", comm.get(),
(comm->mbox ? comm->mbox->get_cname() : "(null)"), this->get_cname());
comm->mbox = nullptr;
xbt_assert(comm->mbox == this, "Comm %p is in mailbox %s, not mailbox %s", comm.get(),
(comm->mbox ? comm->mbox->get_cname() : "(null)"), this->get_cname());
comm->mbox = nullptr;
-smx_activity_t MailboxImpl::iprobe(int type, int (*match_fun)(void*, void*, CommImpl*), void* data)
+CommImplPtr MailboxImpl::iprobe(int type, int (*match_fun)(void*, void*, CommImpl*), void* data)
if (permanent_receiver_ != nullptr && not done_comm_queue_.empty()) {
XBT_DEBUG("first check in the permanent recv mailbox, to see if we already got something");
if (permanent_receiver_ != nullptr && not done_comm_queue_.empty()) {
XBT_DEBUG("first check in the permanent recv mailbox, to see if we already got something");
- other_synchro = find_matching_comm(smx_type, match_fun, data, this_comm, /*done*/ true, /*remove_matching*/ false);
+ other_comm = find_matching_comm(smx_type, match_fun, data, this_comm, /*done*/ true, /*remove_matching*/ false);
- other_synchro = find_matching_comm(smx_type, match_fun, data, this_comm, /*done*/ false, /*remove_matching*/ false);
+ other_comm = find_matching_comm(smx_type, match_fun, data, this_comm, /*done*/ false, /*remove_matching*/ false);
* @return The communication activity if found, nullptr otherwise
*/
CommImplPtr MailboxImpl::find_matching_comm(CommImpl::Type type, int (*match_fun)(void*, void*, CommImpl*),
* @return The communication activity if found, nullptr otherwise
*/
CommImplPtr MailboxImpl::find_matching_comm(CommImpl::Type type, int (*match_fun)(void*, void*, CommImpl*),
- void* this_user_data, CommImplPtr my_synchro, bool done,
+ void* this_user_data, const CommImplPtr& my_synchro, bool done,
- for (auto it = deque->begin(); it != deque->end(); it++) {
- CommImplPtr comm = boost::static_pointer_cast<CommImpl>(std::move(*it));
+ for (auto it = comm_queue.begin(); it != comm_queue.end(); it++) {
+ CommImplPtr& comm = *it;
if (comm->type == type && (match_fun == nullptr || match_fun(this_user_data, other_user_data, comm.get())) &&
(not comm->match_fun || comm->match_fun(other_user_data, this_user_data, my_synchro.get()))) {
XBT_DEBUG("Found a matching communication synchro %p", comm.get());
if (comm->type == type && (match_fun == nullptr || match_fun(this_user_data, other_user_data, comm.get())) &&
(not comm->match_fun || comm->match_fun(other_user_data, this_user_data, my_synchro.get()))) {
XBT_DEBUG("Found a matching communication synchro %p", comm.get());
}
XBT_DEBUG("Sorry, communication synchro %p does not match our needs:"
" its type is %d but we are looking for a comm of type %d (or maybe the filtering didn't match)",
}
XBT_DEBUG("Sorry, communication synchro %p does not match our needs:"
" its type is %d but we are looking for a comm of type %d (or maybe the filtering didn't match)",