Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
remove two functions manipulating msg_mailbox_t
authorMartin Quinson <martin.quinson@loria.fr>
Sun, 31 Jul 2016 16:06:21 +0000 (18:06 +0200)
committerMartin Quinson <martin.quinson@loria.fr>
Sun, 31 Jul 2016 16:06:21 +0000 (18:06 +0200)
ChangeLog
include/simgrid/msg.h
src/msg/msg_gos.cpp
src/msg/msg_mailbox.cpp

index bec4c08..a2539fe 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -12,6 +12,11 @@ SimGrid (3.14) UNRELEASED; urgency=low
    values were ignored in some cases. The timings of these functions can now
    be significantly different.
 
+ MSG
+ * Remove the functions manipulating mailboxes. Use s4u::Mailbox instead
+   - MSG_mailbox_is_empty() -> Mailbox::empty()
+   - MSG_mailbox_get_by_alias -> simgrid::s4u::Mailbox::byName(name)
+
  -- $date Da SimGrid team <simgrid-devel@lists.gforge.inria.fr>
 
 SimGrid (3.13) stable; urgency=low
index 8b0e2f1..6b17183 100644 (file)
@@ -449,20 +449,6 @@ XBT_PUBLIC(void) MSG_task_set_category (msg_task_t task, const char *category);
 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
index 50ea058..2901070 100644 (file)
@@ -242,7 +242,7 @@ msg_error_t MSG_task_receive_ext(msg_task_t * task, const char *alias, double ti
   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) {
@@ -273,7 +273,7 @@ msg_error_t MSG_task_receive_ext_bounded(msg_task_t * task, const char *alias, d
                                          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(). */
@@ -283,7 +283,7 @@ static inline msg_comm_t MSG_task_isend_internal(msg_task_t task, const char *al
 {
   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 */
@@ -435,7 +435,7 @@ msg_comm_t MSG_task_irecv(msg_task_t *task, const char *name)
  */
 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 */
@@ -757,7 +757,7 @@ msg_error_t MSG_task_send_with_timeout(msg_task_t task, const char *alias, doubl
   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()
 
@@ -836,8 +836,8 @@ msg_error_t MSG_task_send_with_timeout_bounded(msg_task_t task, const char *alia
  */
 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());
 }
 
@@ -851,7 +851,7 @@ int MSG_task_listen(const char *alias)
  */
 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)
index aa96e60..ea4b947 100644 (file)
 
 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());
@@ -29,11 +24,6 @@ msg_task_t MSG_mailbox_front(msg_mailbox_t mailbox)
   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
  *
@@ -44,7 +34,7 @@ msg_mailbox_t MSG_mailbox_get_by_alias(const char *alias)
  * \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);