-/** @brief Returns the mailbox of that name, newly created on need */
-MailboxImpl* MailboxImpl::by_name_or_create(const std::string& name)
-{
- /* two actors may have pushed the same mbox_create simcall at the same time */
- auto m = mailboxes.find(name);
- if (m == mailboxes.end()) {
- auto* mbox = new MailboxImpl(name);
- XBT_DEBUG("Creating a mailbox at %p with name %s", mbox, name.c_str());
- mailboxes[name] = mbox;
- return mbox;
- } else
- return m->second;
-}