Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Export some mailbox related functions
authormquinson <mquinson@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Wed, 7 May 2008 20:51:00 +0000 (20:51 +0000)
committermquinson <mquinson@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Wed, 7 May 2008 20:51:00 +0000 (20:51 +0000)
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@5413 48e7efb5-ca39-0410-a469-dd3cf9ba447f

include/msg/datatypes.h
include/msg/msg.h
src/msg/mailbox.h
src/msg/msg_mailbox.c

index e8b5ce1..1debf57 100644 (file)
@@ -64,6 +64,8 @@ typedef struct m_task  *m_task_t;
 
 /** @} */
 
 
 /** @} */
 
+
+
 /* ****************************** Process *********************************** */
 typedef struct simdata_process *simdata_process_t;
 /** @brief Process datatype 
 /* ****************************** Process *********************************** */
 typedef struct simdata_process *simdata_process_t;
 /** @brief Process datatype 
@@ -95,6 +97,19 @@ typedef struct m_process *m_process_t;
 typedef int m_channel_t;
 /** @} */
 
 typedef int m_channel_t;
 /** @} */
 
+/* ******************************** Mailbox ************************************ */
+
+typedef struct s_msg_mailbox* msg_mailbox_t;
+/** @brief Mailbox datatype
+    @ingroup m_datatypes_management_details @{ */
+
+msg_mailbox_t MSG_mailbox_create(const char *alias);
+void MSG_mailbox_free(void* mailbox);
+
+
+/** @} */
+
+
 /* ***************************** Error handling ***************************** */
 /** @brief Error handling 
     @ingroup m_datatypes_management 
 /* ***************************** Error handling ***************************** */
 /** @brief Error handling 
     @ingroup m_datatypes_management 
index 63e5cc3..f6efd0a 100644 (file)
@@ -165,5 +165,12 @@ MSG_task_send_bounded(m_task_t task, const char* alias, double rate);
 XBT_PUBLIC(int)
 MSG_task_listen_from(const char* alias);
 
 XBT_PUBLIC(int)
 MSG_task_listen_from(const char* alias);
 
+/************************** Task handling ************************************/
+XBT_PUBLIC(MSG_error_t)
+MSG_mailbox_get_task_ext(msg_mailbox_t mailbox, m_task_t* task, m_host_t host, double timeout);
+
+XBT_PUBLIC(MSG_error_t)
+MSG_mailbox_put_with_timeout(msg_mailbox_t mailbox, m_task_t task, double timeout);
+
 SG_END_DECL()
 #endif
 SG_END_DECL()
 #endif
index 9534f04..53c5ce2 100644 (file)
@@ -9,9 +9,6 @@ SG_BEGIN_DECL()
 \r
 #define MAX_ALIAS_NAME ((size_t)260)\r
 \r
 \r
 #define MAX_ALIAS_NAME ((size_t)260)\r
 \r
-/* forward declaration */\r
-typedef struct s_msg_mailbox* msg_mailbox_t;\r
-\r
 /*\r
  * Initialization of the mailbox module.\r
  */\r
 /*\r
  * Initialization of the mailbox module.\r
  */\r
index 8b29ed1..160503e 100644 (file)
@@ -20,30 +20,25 @@ MSG_mailbox_mod_exit(void)
 }\r
 \r
 msg_mailbox_t\r
 }\r
 \r
 msg_mailbox_t\r
-MSG_mailbox_new(const char *alias)\r
+MSG_mailbox_create(const char *alias)\r
 {\r
        msg_mailbox_t mailbox = xbt_new0(s_msg_mailbox_t,1);\r
        \r
        mailbox->tasks = xbt_fifo_new();\r
        mailbox->cond = NULL;\r
 {\r
        msg_mailbox_t mailbox = xbt_new0(s_msg_mailbox_t,1);\r
        \r
        mailbox->tasks = xbt_fifo_new();\r
        mailbox->cond = NULL;\r
-       mailbox->alias = xbt_strdup(alias);\r
+        mailbox->alias = alias ? xbt_strdup(alias) : NULL;\r
        mailbox->hostname = NULL;\r
        \r
        mailbox->hostname = NULL;\r
        \r
-       /* add the mbox in the dictionary */\r
-       xbt_dict_set(msg_mailboxes, alias, mailbox, MSG_mailbox_free);\r
-       \r
        return mailbox;\r
 }\r
 \r
 msg_mailbox_t\r
        return mailbox;\r
 }\r
 \r
 msg_mailbox_t\r
-MSG_mailbox_create(const char *alias)\r
+MSG_mailbox_new(const char *alias)\r
 {\r
 {\r
-       msg_mailbox_t mailbox = xbt_new0(s_msg_mailbox_t,1);\r
+       msg_mailbox_t mailbox = MSG_mailbox_create(alias);\r
        \r
        \r
-       mailbox->tasks = xbt_fifo_new();\r
-       mailbox->cond = NULL;\r
-       mailbox->alias = xbt_strdup(alias);\r
-       mailbox->hostname = NULL;\r
+       /* add the mbox in the dictionary */\r
+       xbt_dict_set(msg_mailboxes, alias, mailbox, MSG_mailbox_free);\r
        \r
        return mailbox;\r
 }\r
        \r
        return mailbox;\r
 }\r