XBT_PUBLIC(const char *) MSG_task_get_category (msg_task_t task);
/************************** Mailbox handling ************************************/
-/* @brief MSG_mailbox_get_by_alias - get a mailbox from its alias.
- * Returns the mailbox associated with the key specified by the parameter alias. If the mailbox does not exists,
- * the function creates it.
- * @param alias The alias of the mailbox to return.
- * @return The mailbox associated with the alias specified as parameter or a new one if the key doesn't match.
- */
-XBT_PUBLIC(msg_mailbox_t) MSG_mailbox_get_by_alias(const char *alias);
-
-/* @brief MSG_mailbox_is_empty - test if a mailbox is empty.
- * Tests if a mailbox is empty (contains no msg task).
- * @param mailbox The mailbox to get test.
- * @return 1 if the mailbox is empty, 0 otherwise.
- */
-XBT_PUBLIC(int) MSG_mailbox_is_empty(msg_mailbox_t mailbox);
/* @brief MSG_mailbox_set_async - set a mailbox as eager
* Sets the mailbox to a permanent receiver mode. Messages sent to this mailbox will then be sent just after the send
msg_error_t ret = MSG_OK;
XBT_DEBUG("MSG_task_receive_ext: Trying to receive a message on mailbox '%s'", alias);
try {
- ret = MSG_mailbox_get_task_ext(MSG_mailbox_get_by_alias(alias), task, host, timeout);
+ ret = MSG_mailbox_get_task_ext(simgrid::s4u::Mailbox::byName(alias), task, host, timeout);
}
catch(xbt_ex& e) {
switch (e.category) {
double rate)
{
XBT_DEBUG("MSG_task_receive_ext: Trying to receive a message on mailbox '%s'", alias);
- return MSG_mailbox_get_task_ext_bounded(MSG_mailbox_get_by_alias(alias), task, host, timeout, rate);
+ return MSG_mailbox_get_task_ext_bounded(simgrid::s4u::Mailbox::byName(alias), task, host, timeout, rate);
}
/* Internal function used to factorize code between MSG_task_isend_with_matching() and MSG_task_dsend(). */
{
simdata_task_t t_simdata = nullptr;
msg_process_t myself = SIMIX_process_self();
- msg_mailbox_t mailbox = MSG_mailbox_get_by_alias(alias);
+ msg_mailbox_t mailbox = simgrid::s4u::Mailbox::byName(alias);
int call_end = TRACE_msg_task_put_start(task);
/* Prepare the task to send */
*/
msg_comm_t MSG_task_irecv_bounded(msg_task_t *task, const char *name, double rate)
{
- msg_mailbox_t mbox = MSG_mailbox_get_by_alias(name);
+ msg_mailbox_t mbox = simgrid::s4u::Mailbox::byName(name);
/* FIXME: these functions are not traceable */
/* Sanity check */
simdata_task_t t_simdata = nullptr;
msg_process_t process = MSG_process_self();
simdata_process_t p_simdata = (simdata_process_t) SIMIX_process_self_get_data();
- msg_mailbox_t mailbox = MSG_mailbox_get_by_alias(alias);
+ msg_mailbox_t mailbox = simgrid::s4u::Mailbox::byName(alias);
int call_end = TRACE_msg_task_put_start(task); //must be after CHECK_HOST()
*/
int MSG_task_listen(const char *alias)
{
- msg_mailbox_t mbox = MSG_mailbox_get_by_alias(alias);
- return !MSG_mailbox_is_empty(mbox) ||
+ msg_mailbox_t mbox = simgrid::s4u::Mailbox::byName(alias);
+ return !mbox->empty() ||
(mbox->getImpl()->permanent_receiver && !mbox->getImpl()->done_comm_queue.empty());
}
*/
int MSG_task_listen_from(const char *alias)
{
- msg_mailbox_t mbox = MSG_mailbox_get_by_alias(alias);
+ msg_mailbox_t mbox = simgrid::s4u::Mailbox::byName(alias);
simgrid::kernel::activity::Comm* comm = static_cast<simgrid::kernel::activity::Comm*>(mbox->front());
if (!comm)
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(msg_mailbox, msg, "Logging specific to MSG (mailbox)");
-int MSG_mailbox_is_empty(msg_mailbox_t mailbox)
-{
- return mailbox->empty();
-}
-
msg_task_t MSG_mailbox_front(msg_mailbox_t mailbox)
{
simgrid::kernel::activity::Comm* comm = static_cast<simgrid::kernel::activity::Comm*>(mailbox->front());
return (msg_task_t) comm->src_data;
}
-msg_mailbox_t MSG_mailbox_get_by_alias(const char *alias)
-{
- return simgrid::s4u::Mailbox::byName(alias);
-}
-
/** \ingroup msg_mailbox_management
* \brief Set the mailbox to receive in asynchronous mode
*
* \param alias The name of the mailbox
*/
void MSG_mailbox_set_async(const char *alias){
- msg_mailbox_t mailbox = MSG_mailbox_get_by_alias(alias);
+ simgrid::s4u::MailboxPtr mailbox = simgrid::s4u::Mailbox::byName(alias);
simcall_mbox_set_receiver(mailbox->getImpl(), SIMIX_process_self());
XBT_VERB("%s mailbox set to receive eagerly for myself\n",alias);