1 /* Copyright (c) 2006-2015. The SimGrid Team.
2 * All rights reserved. */
4 /* This program is free software; you can redistribute it and/or modify it
5 * under the terms of the license (GNU LGPL) which comes with this package. */
8 #include "msg/msg_private.h"
9 #include "msg/msg_mailbox.h"
11 #include "simgrid/s4u/mailbox.hpp"
13 XBT_LOG_EXTERNAL_CATEGORY(s4u);
14 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(s4u_channel,s4u,"S4U Communication Mailboxes");
17 using namespace simgrid;
19 boost::unordered_map <std::string, s4u::Mailbox *> *s4u::Mailbox::channels = new boost::unordered_map<std::string, s4u::Mailbox*> ();
22 s4u::Mailbox::Mailbox(const char*name, smx_rdv_t inferior) {
23 p_inferior = inferior;
24 channels->insert({name, this});
26 s4u::Mailbox *s4u::Mailbox::byName(const char*name) {
29 res = channels->at(name);
30 } catch (std::out_of_range& e) {
31 res = new Mailbox(name,simcall_rdv_create(name));