Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
WIP stop using const char* in C++ layers
[simgrid.git] / src / s4u / s4u_mailbox.cpp
index 9e5f3f4..2fa5db2 100644 (file)
@@ -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);
@@ -47,7 +47,9 @@ smx_activity_t Mailbox::front()
 }
 
 void Mailbox::setReceiver(ActorPtr actor) {
-  simcall_mbox_set_receiver(pimpl_, actor == nullptr ? nullptr : actor->pimpl_);
+  simix::kernelImmediate([this, actor]() {
+    this->pimpl_->setReceiver(actor);
+  });
 }
 
 /** @brief get the receiver (process associated to the mailbox) */