5 #include "simix/simix.h"
6 #include "msg/datatypes.h"
10 #define MAX_ALIAS_NAME ((size_t)260)
12 * Initialization of the mailbox module.
14 void MSG_mailbox_mod_init(void);
17 * Terminaison of the mailbox module.
19 void MSG_mailbox_mod_exit(void);
22 /*! \brief MSG_mailbox_new - create a new mailbox.
24 * The function MSG_mailbox_new creates a new mailbox identified by the key specified
25 * by the parameter alias and add it in the global dictionary.
27 * \param alias The alias of the mailbox to create.
29 * \return The newly created mailbox.
31 XBT_PUBLIC(msg_mailbox_t)
32 MSG_mailbox_new(const char *alias);
34 /*! \brief MSG_mailbox_create - create a new mailbox.
36 * The function MSG_mailbox_new creates a new mailbox identified by
37 * the key specified by the parameter alias and add it in the global
38 * dictionary but doesn't add it in the global dictionary. Typicaly,
39 * this type of mailbox is associated with a channel.
41 * \param alias The alias of the mailbox to create.
43 * \return The newly created mailbox.
45 msg_mailbox_t MSG_mailbox_create(const char *alias);
47 /* \brief MSG_mailbox_free - release a mailbox from the memory.
49 * The function MSG_mailbox_free release a mailbox from the memory but does
50 * not remove it from the dictionary.
52 * \param mailbox The mailbox to release.
54 * \see MSG_mailbox_destroy.
56 void MSG_mailbox_free(void *mailbox);
58 /* \brief MSG_mailbox_get_by_alias - get a mailbox from its alias.
60 * The function MSG_mailbox_get_by_alias returns the mailbox associated with
61 * the key specified by the parameter alias. If the mailbox does not exists,
62 * the function create it.
64 * \param alias The alias of the mailbox to return.
66 * \return The mailbox associated with the alias specified as parameter
67 * or a new mailbox if the key does not match.
69 XBT_PUBLIC(msg_mailbox_t)
70 MSG_mailbox_get_by_alias(const char *alias);
72 /* \brief MSG_mailbox_get_by_channel - get a mailbox of the specified host from its channel.
74 * The function MSG_mailbox_get_by_channel returns the mailbox of the
75 * specified host from the channel specified by the parameter
76 * channel. If the mailbox does not exists, the function fails.
78 * \param host The host containing he mailbox to get.
79 * \param channel The channel used to identify the mailbox.
81 * \return The mailbox of the specified host associated the channel
82 * specified as parameter.
85 XBT_PUBLIC(msg_mailbox_t)
86 MSG_mailbox_get_by_channel(m_host_t host, m_channel_t channel);
88 /*! \brief MSG_mailbox_get_alias - get the alias associated with the mailbox.
90 * The function MSG_mailbox_get_alias returns the alias of the mailbox specified
91 * by the parameter mailbox.
93 * \param mailbox The mailbox to get the alias.
95 * \return The alias of the mailbox specified by the parameter mailbox.
97 XBT_PUBLIC(const char *) MSG_mailbox_get_alias(msg_mailbox_t mailbox);
99 /*! \brief MSG_mailbox_get_cond - get the simix condition of a mailbox.
101 * The function MSG_mailbox_get_cond returns the condition of the
102 * mailbox specified by the parameter mailbox.
104 * \param mailbox The mailbox to get the condition.
106 * \return The simix condition of the mailbox specified by the parameter mailbox.
108 XBT_PUBLIC(smx_cond_t)
109 MSG_mailbox_get_cond(msg_mailbox_t mailbox);
111 /*! \brief MSG_mailbox_set_cond - set the simix condition of a mailbox.
113 * The function MSG_mailbox_set_cond set the condition of the mailbox
114 * specified by the parameter mailbox.
116 * \param mailbox The mailbox to set the condition.
117 * \param cond The new simix condition of the mailbox.
120 XBT_PUBLIC(void) MSG_mailbox_set_cond(msg_mailbox_t mailbox, smx_cond_t cond);
122 /*! \brief MSG_mailbox_is_empty - test if a mailbox is empty.
124 * The function MSG_mailbox_is_empty tests if a mailbox is empty
125 * (contains no msg task).
127 * \param mailbox The mailbox to get test.
129 * \return The function returns 1 if the mailbox is empty. Otherwise the function
132 XBT_PUBLIC(int) MSG_mailbox_is_empty(msg_mailbox_t mailbox);
134 /*! \brief MSG_mailbox_get_head - get the task at the head of a mailbox.
136 * The MSG_mailbox_get_head returns the task at the head of the mailbox.
137 * This function does not remove the task from the mailbox (contrary to
138 * the function MSG_mailbox_pop_head).
140 * \param mailbox The mailbox concerned by the operation.
142 * \return The task at the head of the mailbox.
145 MSG_mailbox_get_head(msg_mailbox_t mailbox);
147 /*! \brief MSG_mailbox_get_count_host_waiting_tasks - Return the number of tasks
148 waiting to be received in a mailbox and sent by a host.
150 * \param mailbox The mailbox concerned by the operation.
151 * \param host The msg host containing the processes that have sended the
154 * \return The number of tasks in the mailbox specified by the
155 * parameter mailbox and sended by all the processes located
156 * on the host specified by the parameter host.
159 MSG_mailbox_get_count_host_waiting_tasks(msg_mailbox_t mailbox,
164 #endif /* !SMX_MAILBOX_H */