WRENCH  1.11
Cyberinfrastructure Simulation Workbench
Overview Installation Getting Started WRENCH 101 WRENCH 102
S4U_Mailbox.h
1 
11 #ifndef WRENCH_S4U_MAILBOX_H
12 #define WRENCH_S4U_MAILBOX_H
13 
14 
15 #include <string>
16 #include <map>
17 #include <set>
18 
19 #include <simgrid/s4u.hpp>
20 
21 namespace wrench {
22 
23  /***********************/
25  /***********************/
26 
27  class SimulationMessage;
28  class S4U_PendingCommunication;
29 
33  class S4U_Mailbox {
34 
35  public:
36  static std::unique_ptr<SimulationMessage> getMessage(simgrid::s4u::Mailbox *mailbox);
37  static std::unique_ptr<SimulationMessage> getMessage(simgrid::s4u::Mailbox *mailbox, double timeout);
38  static void putMessage(simgrid::s4u::Mailbox *mailbox, SimulationMessage *m);
39  static void dputMessage(simgrid::s4u::Mailbox *mailbox, SimulationMessage *msg);
40  static std::shared_ptr<S4U_PendingCommunication> iputMessage(simgrid::s4u::Mailbox *mailbox, SimulationMessage *msg);
41  static std::shared_ptr<S4U_PendingCommunication> igetMessage(simgrid::s4u::Mailbox *mailbox);
42 
43  static unsigned long generateUniqueSequenceNumber();
44 
45  static simgrid::s4u::Mailbox *getTemporaryMailbox();
46  static void retireTemporaryMailbox(simgrid::s4u::Mailbox *mailbox);
47 
48  static void createMailboxPool(unsigned long num_mailboxes);
49 
50  static simgrid::s4u::Mailbox *generateUniqueMailbox(std::string prefix);
51 
52  static unsigned long mailbox_pool_size;
53 
54  private:
55  static std::deque<simgrid::s4u::Mailbox *> free_mailboxes;
56  static std::set<simgrid::s4u::Mailbox *> used_mailboxes;
57  static std::deque<simgrid::s4u::Mailbox *> mailboxes_to_drain;
58 
59 
60  };
61 
62  /***********************/
64  /***********************/
65 
66 };
67 
68 
69 #endif //WRENCH_S4U_MAILBOX_H
wrench
Definition: Action.cpp:28