Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Add a MSG_mailbox_set_async function to allow to set a mailbox to eagerly receive...
authorAugustin Degomme <degomme@idpann.imag.fr>
Wed, 8 Aug 2012 09:18:40 +0000 (11:18 +0200)
committerAugustin Degomme <degomme@idpann.imag.fr>
Wed, 8 Aug 2012 09:22:12 +0000 (11:22 +0200)
include/msg/msg.h
src/msg/msg_mailbox.c
src/msg/msg_mailbox.h

index e3b5ac1..24bf774 100644 (file)
@@ -263,6 +263,9 @@ XBT_PUBLIC(msg_error_t)
     MSG_mailbox_put_with_timeout(msg_mailbox_t mailbox, msg_task_t task,
                              double timeout);
 
     MSG_mailbox_put_with_timeout(msg_mailbox_t mailbox, msg_task_t task,
                              double timeout);
 
+void MSG_mailbox_set_async(const char *alias);
+
+
 /************************** Action handling **********************************/
 msg_error_t MSG_action_trace_run(char *path);
 
 /************************** Action handling **********************************/
 msg_error_t MSG_action_trace_run(char *path);
 
index 8d1e7c9..d8509ed 100644 (file)
@@ -56,6 +56,14 @@ msg_mailbox_t MSG_mailbox_get_by_alias(const char *alias)
   return mailbox;
 }
 
   return mailbox;
 }
 
+void MSG_mailbox_set_async(const char *alias){
+  msg_mailbox_t mailbox = MSG_mailbox_get_by_alias(alias);
+
+  mailbox->permanent_receiver=SIMIX_process_self();
+  XBT_VERB("%s mailbox set to receive eagerly for process %p\n",alias, SIMIX_process_self());
+
+}
+
 msg_error_t
 MSG_mailbox_get_task_ext(msg_mailbox_t mailbox, msg_task_t * task,
                          msg_host_t host, double timeout)
 msg_error_t
 MSG_mailbox_get_task_ext(msg_mailbox_t mailbox, msg_task_t * task,
                          msg_host_t host, double timeout)
index ded6199..9f3f379 100644 (file)
@@ -66,6 +66,19 @@ XBT_PUBLIC(msg_mailbox_t)
  */
 XBT_PUBLIC(int) MSG_mailbox_is_empty(msg_mailbox_t mailbox);
 
  */
 XBT_PUBLIC(int) MSG_mailbox_is_empty(msg_mailbox_t mailbox);
 
+/* \brief MSG_mailbox_set_async - set a mailbox as eager
+ *
+ * The function MSG_mailbox_set_async sets the mailbox to a permanent receiver mode
+ * Messages sent to this mailbox will then be sent just after the send is issued,
+ * without waiting for the corresponding receive.
+ *
+ * This call should be done before issuing any receive, and on the receiver's side only
+ *
+ * \param alias    The alias of the mailbox to modify.
+ *
+ */
+void MSG_mailbox_set_async(const char *alias);
+
 /*! \brief MSG_mailbox_get_head - get the task at the head of a mailbox.
  *
  * The MSG_mailbox_get_head returns the task at the head of the mailbox.
 /*! \brief MSG_mailbox_get_head - get the task at the head of a mailbox.
  *
  * The MSG_mailbox_get_head returns the task at the head of the mailbox.