X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/8250fdfeb9c8dd3ae2a1d19f3c89871c9599d0f8..3ba5d4a966c2ac976b2b1656c52145f70189d108:/src/s4u/s4u_mailbox.cpp diff --git a/src/s4u/s4u_mailbox.cpp b/src/s4u/s4u_mailbox.cpp index ed78c0338c..288205124b 100644 --- a/src/s4u/s4u_mailbox.cpp +++ b/src/s4u/s4u_mailbox.cpp @@ -22,10 +22,10 @@ const char *Mailbox::name() { MailboxPtr Mailbox::byName(const char*name) { - simix::MailboxImpl* mbox = simix::MailboxImpl::byNameOrNull(name); + kernel::activity::MailboxImpl* mbox = kernel::activity::MailboxImpl::byNameOrNull(name); if (mbox == nullptr) { mbox = simix::kernelImmediate([name] { - return simix::MailboxImpl::byNameOrCreate(name); + return kernel::activity::MailboxImpl::byNameOrCreate(name); }); } return MailboxPtr(&mbox->piface_, true); @@ -41,6 +41,11 @@ bool Mailbox::empty() return pimpl_->comm_queue.empty(); } +bool Mailbox::listen() +{ + return not this->empty() || (pimpl_->permanent_receiver && not pimpl_->done_comm_queue.empty()); +} + smx_activity_t Mailbox::front() { return pimpl_->comm_queue.empty() ? nullptr : pimpl_->comm_queue.front(); @@ -54,9 +59,9 @@ void Mailbox::setReceiver(ActorPtr actor) { /** @brief get the receiver (process associated to the mailbox) */ ActorPtr Mailbox::receiver() { - if(pimpl_->permanent_receiver == nullptr) + if (pimpl_->permanent_receiver == nullptr) return ActorPtr(); - return ActorPtr(&pimpl_->permanent_receiver->getIface()); + return pimpl_->permanent_receiver->iface(); } }