From: mquinson Date: Wed, 7 May 2008 20:51:00 +0000 (+0000) Subject: Export some mailbox related functions X-Git-Tag: v3.3~515 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/ba26409dfb68b4eb12207ba64a996558177d4195?ds=sidebyside Export some mailbox related functions git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@5413 48e7efb5-ca39-0410-a469-dd3cf9ba447f --- diff --git a/include/msg/datatypes.h b/include/msg/datatypes.h index e8b5ce161f..1debf57860 100644 --- a/include/msg/datatypes.h +++ b/include/msg/datatypes.h @@ -64,6 +64,8 @@ typedef struct m_task *m_task_t; /** @} */ + + /* ****************************** 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; /** @} */ +/* ******************************** 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 diff --git a/include/msg/msg.h b/include/msg/msg.h index 63e5cc37d4..f6efd0ac54 100644 --- a/include/msg/msg.h +++ b/include/msg/msg.h @@ -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); +/************************** 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 diff --git a/src/msg/mailbox.h b/src/msg/mailbox.h index 9534f04152..53c5ce25ee 100644 --- a/src/msg/mailbox.h +++ b/src/msg/mailbox.h @@ -9,9 +9,6 @@ SG_BEGIN_DECL() #define MAX_ALIAS_NAME ((size_t)260) -/* forward declaration */ -typedef struct s_msg_mailbox* msg_mailbox_t; - /* * Initialization of the mailbox module. */ diff --git a/src/msg/msg_mailbox.c b/src/msg/msg_mailbox.c index 8b29ed148c..160503eccf 100644 --- a/src/msg/msg_mailbox.c +++ b/src/msg/msg_mailbox.c @@ -20,30 +20,25 @@ MSG_mailbox_mod_exit(void) } msg_mailbox_t -MSG_mailbox_new(const char *alias) +MSG_mailbox_create(const char *alias) { msg_mailbox_t mailbox = xbt_new0(s_msg_mailbox_t,1); mailbox->tasks = xbt_fifo_new(); mailbox->cond = NULL; - mailbox->alias = xbt_strdup(alias); + mailbox->alias = alias ? xbt_strdup(alias) : NULL; mailbox->hostname = NULL; - /* add the mbox in the dictionary */ - xbt_dict_set(msg_mailboxes, alias, mailbox, MSG_mailbox_free); - return mailbox; } msg_mailbox_t -MSG_mailbox_create(const char *alias) +MSG_mailbox_new(const char *alias) { - msg_mailbox_t mailbox = xbt_new0(s_msg_mailbox_t,1); + msg_mailbox_t mailbox = MSG_mailbox_create(alias); - mailbox->tasks = xbt_fifo_new(); - mailbox->cond = NULL; - mailbox->alias = xbt_strdup(alias); - mailbox->hostname = NULL; + /* add the mbox in the dictionary */ + xbt_dict_set(msg_mailboxes, alias, mailbox, MSG_mailbox_free); return mailbox; }