5 #include "simix/private.h"
6 #include "msg/datatypes.h"
9 #define MAX_ALIAS_NAME ((size_t)260)
11 * Initialization of the mailbox module.
13 void MSG_mailbox_mod_init(void);
16 * Terminaison of the mailbox module.
18 void MSG_mailbox_mod_exit(void);
21 /*! \brief MSG_mailbox_new - create a new mailbox.
23 * The function MSG_mailbox_new creates a new mailbox identified by the key specified
24 * by the parameter alias and add it in the global dictionary.
26 * \param alias The alias of the mailbox to create.
28 * \return The newly created mailbox.
30 XBT_PUBLIC(msg_mailbox_t)
31 MSG_mailbox_new(const char *alias);
33 /*! \brief MSG_mailbox_create - create a new mailbox.
35 * The function MSG_mailbox_new creates a new mailbox identified by
36 * the key specified by the parameter alias and add it in the global
37 * dictionary but doesn't add it in the global dictionary. Typicaly,
38 * this type of mailbox is associated with a channel.
40 * \param alias The alias of the mailbox to create.
42 * \return The newly created mailbox.
45 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.
57 MSG_mailbox_free(void *mailbox);
59 /* \brief MSG_mailbox_get_by_alias - get a mailbox from its alias.
61 * The function MSG_mailbox_get_by_alias returns the mailbox associated with
62 * the key specified by the parameter alias. If the mailbox does not exists,
63 * the function create it.
65 * \param alias The alias of the mailbox to return.
67 * \return The mailbox associated with the alias specified as parameter
68 * or a new mailbox if the key does not match.
70 XBT_PUBLIC(msg_mailbox_t)
71 MSG_mailbox_get_by_alias(const char *alias);
73 /* \brief MSG_mailbox_get_by_channel - get a mailbox of the specified host from its channel.
75 * The function MSG_mailbox_get_by_channel returns the mailbox of the
76 * specified host from the channel specified by the parameter
77 * channel. If the mailbox does not exists, the function fails.
79 * \param host The host containing he mailbox to get.
80 * \param channel The channel used to identify the mailbox.
82 * \return The mailbox of the specified host associated the channel
83 * specified as parameter.
86 XBT_PUBLIC(msg_mailbox_t)
87 MSG_mailbox_get_by_channel(m_host_t host, m_channel_t channel);
89 /*! \brief MSG_mailbox_get_alias - get the alias associated with the mailbox.
91 * The function MSG_mailbox_get_alias returns the alias of the mailbox specified
92 * by the parameter mailbox.
94 * \param mailbox The mailbox to get the alias.
96 * \return The alias of the mailbox specified by the parameter mailbox.
98 XBT_PUBLIC(const char *)
99 MSG_mailbox_get_alias(msg_mailbox_t mailbox);
101 /*! \brief MSG_mailbox_get_cond - get the simix condition of a mailbox.
103 * The function MSG_mailbox_get_cond returns the condition of the
104 * mailbox specified by the parameter mailbox.
106 * \param mailbox The mailbox to get the condition.
108 * \return The simix condition of the mailbox specified by the parameter mailbox.
110 XBT_PUBLIC(smx_cond_t)
111 MSG_mailbox_get_cond(msg_mailbox_t mailbox);
113 /*! \brief MSG_mailbox_set_cond - set the simix condition of a mailbox.
115 * The function MSG_mailbox_set_cond set the condition of the mailbox
116 * specified by the parameter mailbox.
118 * \param mailbox The mailbox to set the condition.
119 * \param cond The new simix condition of the mailbox.
123 MSG_mailbox_set_cond(msg_mailbox_t mailbox, smx_cond_t cond);
125 /*! \brief MSG_mailbox_get_hostname - get the name of the host owned a mailbox.
127 * The function MSG_mailbox_get_hostname returns name of the host
128 * owned the mailbox specified by the parameter mailbox.
130 * \param mailbox The mailbox to get the name of the host.
132 * \return The name of the host owned the mailbox specified by the parameter mailbox.
134 XBT_PUBLIC(const char *)
135 MSG_mailbox_get_hostname(msg_mailbox_t mailbox);
137 /*! \brief MSG_mailbox_set_hostname - set the name of the host owned a mailbox.
139 * The function MSG_mailbox_set_hostname sets the name of the host
140 * owned the mailbox specified by the parameter mailbox.
142 * \param mailbox The mailbox to set the name of the host.
143 * \param hostname The name of the owner of the mailbox.
147 MSG_mailbox_set_hostname(msg_mailbox_t mailbox, const char *hostname);
150 /*! \brief MSG_mailbox_is_empty - test if a mailbox is empty.
152 * The function MSG_mailbox_is_empty tests if a mailbox is empty
153 * (contains no msg task).
155 * \param mailbox The mailbox to get test.
157 * \return The function returns 1 if the mailbox is empty. Otherwise the function
161 MSG_mailbox_is_empty(msg_mailbox_t mailbox);
163 /*! \brief MSG_mailbox_remove - remove a task from a mailbox.
165 * The MSG_mailbox_remove removes a task from a specified mailbox.
167 * \param mailbox The mailbox concerned by this operation.
168 * \param task The task to remove from the mailbox.
171 MSG_mailbox_remove(msg_mailbox_t mailbox, m_task_t task);
173 /*! \brief MSG_mailbox_get_head - get the task at the head of a mailbox.
175 * The MSG_mailbox_get_head returns the task at the head of the mailbox.
176 * This function does not remove the task from the mailbox (contrary to
177 * the function MSG_mailbox_pop_head).
179 * \param mailbox The mailbox concerned by the operation.
181 * \return The task at the head of the mailbox.
184 MSG_mailbox_get_head(msg_mailbox_t mailbox);
186 /*! \brief MSG_mailbox_pop_head - get the task at the head of a mailbox
187 * and remove it from it.
189 * The MSG_mailbox_pop_head returns the task at the head of the mailbox
190 * and remove it from it.
192 * \param mailbox The mailbox concerned by the operation.
194 * \return The task at the head of the mailbox.
197 MSG_mailbox_pop_head(msg_mailbox_t mailbox);
199 /*! \brief MSG_mailbox_get_first_host_task - get the first msg task
200 * of a specified mailbox, sended by a process of a specified host.
202 * \param mailbox The mailbox concerned by the operation.
203 * \param host The msg host of the process that has sended the
206 * \return The first task in the mailbox specified by the
207 * parameter mailbox and sended by a process located
208 * on the host specified by the parameter host.
211 MSG_mailbox_get_first_host_task(msg_mailbox_t mailbox, m_host_t host);
213 /*! \brief MSG_mailbox_get_count_host_waiting_tasks - Return the number of tasks
214 waiting to be received in a mailbox and sent by a host.
216 * \param mailbox The mailbox concerned by the operation.
217 * \param host The msg host containing the processes that have sended the
220 * \return The number of tasks in the mailbox specified by the
221 * parameter mailbox and sended by all the processes located
222 * on the host specified by the parameter host.
225 MSG_mailbox_get_count_host_waiting_tasks(msg_mailbox_t mailbox,
231 #endif /* !SMX_MAILBOX_H */