Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
SIMIX_mbox_get_head() -> simcall_mbox_front()
authorMartin Quinson <martin.quinson@loria.fr>
Mon, 9 May 2016 15:51:17 +0000 (17:51 +0200)
committerMartin Quinson <martin.quinson@loria.fr>
Mon, 9 May 2016 15:51:23 +0000 (17:51 +0200)
smx_mailbox should be objects. They should be merged into s4u::Mailbox

13 files changed:
include/simgrid/msg.h
include/simgrid/simix.h
src/msg/msg_gos.cpp
src/msg/msg_mailbox.cpp
src/s4u/s4u_mailbox.cpp
src/simix/libsmx.cpp
src/simix/popping_accessors.h
src/simix/popping_bodies.cpp
src/simix/popping_enum.h
src/simix/popping_generated.cpp
src/simix/simcalls.in
src/simix/smx_network.cpp
src/simix/smx_network_private.h

index ee53c52..d2450b4 100644 (file)
@@ -484,7 +484,7 @@ XBT_PUBLIC(void) MSG_mailbox_set_async(const char *alias);
  * @param   mailbox  The mailbox concerned by the operation.
  * @return           The task at the head of the mailbox.
  */
-XBT_PUBLIC(msg_task_t) MSG_mailbox_get_head(msg_mailbox_t mailbox);
+XBT_PUBLIC(msg_task_t) MSG_mailbox_front(msg_mailbox_t mailbox);
 
 XBT_PUBLIC(msg_error_t) MSG_mailbox_get_task_ext(msg_mailbox_t mailbox, msg_task_t * task, msg_host_t host,
                                                  double timeout);
@@ -597,5 +597,10 @@ xbt_dynar_t<msg_vm_t> MSG_vm_get_list_from_hosts(msg_dynar_t<msg_host_t>)
 /* Used only by the bindings -- unclean pimple, please ignore if you're not writing a binding */
 XBT_PUBLIC(smx_context_t) MSG_process_get_smx_ctx(msg_process_t process);
 
+
+/* Functions renamed in 3.14 */
+#define MSG_mailbox_get_head(m) MSG_mailbox_front(m)
+
+
 SG_END_DECL()
 #endif
index a01895f..4b7d955 100644 (file)
@@ -351,7 +351,7 @@ XBT_PUBLIC(e_smx_state_t) simcall_process_sleep(double duration);
 
 XBT_PUBLIC(smx_mailbox_t) simcall_mbox_create(const char *name);
 XBT_PUBLIC(smx_mailbox_t) simcall_mbox_get_by_name(const char *name);
-XBT_PUBLIC(smx_synchro_t) simcall_mbox_get_head(smx_mailbox_t mbox);
+XBT_PUBLIC(smx_synchro_t) simcall_mbox_front(smx_mailbox_t mbox);
 XBT_PUBLIC(void) simcall_mbox_set_receiver(smx_mailbox_t mbox , smx_process_t process);
 
 /***** Communication simcalls *****/
index ec226a7..d4f3d7f 100644 (file)
@@ -915,7 +915,7 @@ int MSG_task_listen_from(const char *alias)
 {
   msg_task_t task;
 
-  if (NULL == (task = MSG_mailbox_get_head(MSG_mailbox_get_by_alias(alias))))
+  if (NULL == (task = MSG_mailbox_front(MSG_mailbox_get_by_alias(alias))))
     return -1;
 
   return MSG_process_get_PID(task->simdata->sender);
index 11ce7d8..90d2896 100644 (file)
@@ -18,12 +18,12 @@ msg_mailbox_t MSG_mailbox_new(const char *alias)
 
 int MSG_mailbox_is_empty(msg_mailbox_t mailbox)
 {
-  return (NULL == simcall_mbox_get_head(mailbox));
+  return (NULL == simcall_mbox_front(mailbox));
 }
 
-msg_task_t MSG_mailbox_get_head(msg_mailbox_t mailbox)
+msg_task_t MSG_mailbox_front(msg_mailbox_t mailbox)
 {
-  smx_synchro_t comm = simcall_mbox_get_head(mailbox);
+  smx_synchro_t comm = simcall_mbox_front(mailbox);
 
   if (!comm)
     return NULL;
index 93a0c69..f266128 100644 (file)
@@ -43,7 +43,7 @@ s4u::Mailbox *s4u::Mailbox::byName(const char*name) {
 }
 
 bool s4u::Mailbox::empty() {
-  return nullptr == simcall_mbox_get_head(pimpl_);
+  return nullptr == simcall_mbox_front(pimpl_);
 }
 
 void s4u::Mailbox::setReceiver(smx_process_t process) {
index d574071..7808a11 100644 (file)
@@ -686,9 +686,10 @@ smx_mailbox_t simcall_mbox_get_by_name(const char *name)
  *  \param mbox The rendez-vous point
  *  \return The communication or NULL if empty
  */
-smx_synchro_t simcall_mbox_get_head(smx_mailbox_t mbox)
+smx_synchro_t simcall_mbox_front(smx_mailbox_t mbox)
 {
-  return simcall_BODY_mbox_get_head(mbox);
+
+  return mbox->comm_queue->empty()? nullptr:mbox->comm_queue->front();
 }
 
 void simcall_mbox_set_receiver(smx_mailbox_t mbox, smx_process_t process)
index 0070fcc..edf29a8 100644 (file)
@@ -419,19 +419,6 @@ static inline void simcall_mbox_create__set__result(smx_simcall_t simcall, void*
     simcall->result.dp = result;
 }
 
-static inline smx_mailbox_t simcall_mbox_get_head__get__mbox(smx_simcall_t simcall) {
-  return (smx_mailbox_t) simcall->args[0].dp;
-}
-static inline void simcall_mbox_get_head__set__mbox(smx_simcall_t simcall, void* arg) {
-    simcall->args[0].dp = arg;
-}
-static inline smx_synchro_t simcall_mbox_get_head__get__result(smx_simcall_t simcall){
-    return (smx_synchro_t) simcall->result.dp;
-}
-static inline void simcall_mbox_get_head__set__result(smx_simcall_t simcall, void* result){
-    simcall->result.dp = result;
-}
-
 static inline smx_mailbox_t simcall_mbox_set_receiver__get__mbox(smx_simcall_t simcall) {
   return (smx_mailbox_t) simcall->args[0].dp;
 }
index 2d6f513..44f5cd5 100644 (file)
@@ -612,27 +612,6 @@ inline static smx_mailbox_t simcall_BODY_mbox_create(const char* name) {
     return (smx_mailbox_t) self->simcall.result.dp;
   }
   
-inline static smx_synchro_t simcall_BODY_mbox_get_head(smx_mailbox_t mbox) {
-    smx_process_t self = SIMIX_process_self();
-
-    /* Go to that function to follow the code flow through the simcall barrier */
-    if (0) SIMIX_mbox_get_head(mbox);
-    /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */
-
-    self->simcall.call = SIMCALL_MBOX_GET_HEAD;
-    memset(&self->simcall.result, 0, sizeof(self->simcall.result));
-    memset(self->simcall.args, 0, sizeof(self->simcall.args));
-    self->simcall.args[0].dp = (void*) mbox;
-    if (self != simix_global->maestro_process) {
-      XBT_DEBUG("Yield process '%s' on simcall %s (%d)", self->name,
-                SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call);
-      SIMIX_process_yield(self);
-    } else {
-      SIMIX_simcall_handle(&self->simcall, 0);
-    }    
-    return (smx_synchro_t) self->simcall.result.dp;
-  }
-  
 inline static void simcall_BODY_mbox_set_receiver(smx_mailbox_t mbox, smx_process_t receiver) {
     smx_process_t self = SIMIX_process_self();
 
index 6e12268..1228fd0 100644 (file)
@@ -45,7 +45,6 @@ typedef enum {
   SIMCALL_PROCESS_AUTO_RESTART_SET,
   SIMCALL_PROCESS_RESTART,
   SIMCALL_MBOX_CREATE,
-  SIMCALL_MBOX_GET_HEAD,
   SIMCALL_MBOX_SET_RECEIVER,
   SIMCALL_COMM_IPROBE,
   SIMCALL_COMM_SEND,
index 628f4f2..9bc3bb2 100644 (file)
@@ -50,7 +50,6 @@ const char* simcall_names[] = {
   "SIMCALL_PROCESS_AUTO_RESTART_SET",
   "SIMCALL_PROCESS_RESTART",
   "SIMCALL_MBOX_CREATE",
-  "SIMCALL_MBOX_GET_HEAD",
   "SIMCALL_MBOX_SET_RECEIVER",
   "SIMCALL_COMM_IPROBE",
   "SIMCALL_COMM_SEND",
@@ -241,11 +240,6 @@ case SIMCALL_MBOX_CREATE:
       SIMIX_simcall_answer(simcall);
       break;  
 
-case SIMCALL_MBOX_GET_HEAD:
-      simcall->result.dp = SIMIX_mbox_get_head((smx_mailbox_t) simcall->args[0].dp);
-      SIMIX_simcall_answer(simcall);
-      break;  
-
 case SIMCALL_MBOX_SET_RECEIVER:
        SIMIX_mbox_set_receiver((smx_mailbox_t) simcall->args[0].dp,(smx_process_t) simcall->args[1].dp);
       SIMIX_simcall_answer(simcall);
index b7db01e..f63fa0d 100644 (file)
@@ -77,7 +77,6 @@ Proc - process_auto_restart_set (void) (process, void*, smx_process_t) (auto_res
 Func H process_restart (void*, smx_process_t) (process, void*, smx_process_t)
 
 Func - mbox_create (void*, smx_mailbox_t) (name, const char*)
-Func - mbox_get_head (void*, smx_synchro_t) (mbox, void*, smx_mailbox_t)
 Proc - mbox_set_receiver (void) (mbox, void*, smx_mailbox_t) (receiver, void*, smx_process_t)
 
 Func H comm_iprobe (void*, smx_synchro_t) (mbox, void*, smx_mailbox_t) (type, int) (src, int) (tag, int) (match_fun, FPtr, simix_match_func_t) (data, void*)
index 54367da..7d0ffeb 100644 (file)
@@ -69,11 +69,6 @@ smx_mailbox_t SIMIX_mbox_get_by_name(const char *name)
   return (smx_mailbox_t) xbt_dict_get_or_null(mailboxes, name);
 }
 
-smx_synchro_t SIMIX_mbox_get_head(smx_mailbox_t mbox)
-{
-  return mbox->comm_queue->empty()? nullptr:mbox->comm_queue->front();
-}
-
 /**
  *  \brief set the receiver of the rendez vous point to allow eager sends
  *  \param mbox The rendez-vous point
index f628116..403e29a 100644 (file)
@@ -26,7 +26,6 @@ XBT_PRIVATE void SIMIX_mailbox_exit(void);
 XBT_PRIVATE smx_mailbox_t SIMIX_mbox_create(const char *name);
 XBT_PRIVATE smx_mailbox_t SIMIX_mbox_get_by_name(const char *name);
 XBT_PRIVATE void SIMIX_mbox_remove(smx_mailbox_t mbox, smx_synchro_t comm);
-XBT_PRIVATE smx_synchro_t SIMIX_mbox_get_head(smx_mailbox_t mbox);
 XBT_PRIVATE void SIMIX_mbox_set_receiver(smx_mailbox_t mbox, smx_process_t proc);
 XBT_PRIVATE smx_synchro_t SIMIX_comm_irecv(smx_process_t dst_proc, smx_mailbox_t mbox,
                               void *dst_buff, size_t *dst_buff_size,