Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
add getter/setter functions in simix to access more cleanly the process associated...
authorAugustin Degomme <degomme@idpann.imag.fr>
Wed, 8 Aug 2012 15:58:02 +0000 (17:58 +0200)
committerAugustin Degomme <degomme@idpann.imag.fr>
Wed, 8 Aug 2012 15:58:02 +0000 (17:58 +0200)
include/simgrid/simix.h
src/msg/msg_mailbox.c
src/msg/msg_private.h
src/simix/smx_network.c
src/smpi/smpi_global.c

index 55a834b..b3eff4d 100644 (file)
@@ -365,6 +365,8 @@ XBT_PUBLIC(void) simcall_rdv_destroy(smx_rdv_t rvp);
 XBT_PUBLIC(smx_rdv_t) simcall_rdv_get_by_name(const char *name);
 XBT_PUBLIC(int) simcall_rdv_comm_count_by_host(smx_rdv_t rdv, smx_host_t host);
 XBT_PUBLIC(smx_action_t) simcall_rdv_get_head(smx_rdv_t rdv);
+XBT_PUBLIC(smx_process_t) SIMIX_rdv_get_receiver(smx_rdv_t rdv);
+XBT_PUBLIC(void) SIMIX_rdv_set_receiver(smx_rdv_t rdv , smx_process_t process);
 
 XBT_PUBLIC(xbt_dict_t) SIMIX_get_rdv_points(void);
 
index d8509ed..14b1540 100644 (file)
@@ -59,7 +59,7 @@ msg_mailbox_t MSG_mailbox_get_by_alias(const char *alias)
 void MSG_mailbox_set_async(const char *alias){
   msg_mailbox_t mailbox = MSG_mailbox_get_by_alias(alias);
 
-  mailbox->permanent_receiver=SIMIX_process_self();
+  SIMIX_rdv_set_receiver(mailbox, SIMIX_process_self());
   XBT_VERB("%s mailbox set to receive eagerly for process %p\n",alias, SIMIX_process_self());
 
 }
index 4d84ce1..3c6c04d 100644 (file)
@@ -16,7 +16,6 @@
 #include "xbt/dict.h"
 #include "xbt/config.h"
 #include "instr/instr_private.h"
-#include "simix/smx_private.h"
 SG_BEGIN_DECL()
 
 /**************** datatypes **********************************/
index 7737e92..0ce248a 100644 (file)
@@ -104,6 +104,26 @@ smx_action_t SIMIX_rdv_get_head(smx_rdv_t rdv)
   return xbt_fifo_get_item_content(xbt_fifo_get_first_item(rdv->comm_fifo));
 }
 
+/**
+ *  \brief get the receiver (process associated to the mailbox)
+ *  \param rdv The rendez-vous point
+ *  \return process The receiving process (NULL if not set)
+ */
+smx_process_t SIMIX_rdv_get_receiver(smx_rdv_t rdv)
+{
+  return rdv->permanent_receiver;
+}
+
+/**
+ *  \brief set the receiver of the rendez vous point to allow eager sends
+ *  \param rdv The rendez-vous point
+ *  \param process The receiving process
+ */
+void SIMIX_rdv_set_receiver(smx_rdv_t rdv , smx_process_t process)
+{
+   rdv->permanent_receiver=process;
+}
+
 /**
  *  \brief Pushes a communication action into a rendez-vous point
  *  \param rdv The rendez-vous point
index cdbdc96..4560524 100644 (file)
@@ -67,7 +67,7 @@ void smpi_process_init(int *argc, char ***argv)
     (*argc)--;
     data->argc = argc;
     data->argv = argv;
-    data->mailbox_small->permanent_receiver=proc;// set the process attached to the mailbox
+    SIMIX_rdv_set_receiver(data->mailbox_small, proc);// set the process attached to the mailbox
     XBT_DEBUG("<%d> New process in the game: %p", index, proc);
   }
 }