Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Add MSG_process_join [#13601]
[simgrid.git] / src / simix / smx_smurf.c
index 0dc477f..e36f6d2 100644 (file)
@@ -1,7 +1,15 @@
+/* Copyright (c) 2010-2014. The SimGrid Team.
+ * All rights reserved.                                                     */
+
+/* This program is free software; you can redistribute it and/or modify it
+ * under the terms of the license (GNU LGPL) which comes with this package. */
+
 #include "smx_private.h"
 #include "xbt/fifo.h"
 #include "xbt/xbt_os_thread.h"
-#include "../mc/mc_private.h"
+#ifdef HAVE_MC
+#include "mc/mc_private.h"
+#endif
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(simix_smurf, simix,
                                 "Logging specific to SIMIX (SMURF)");
@@ -48,12 +56,14 @@ void SIMIX_simcall_answer(smx_simcall_t simcall)
 void SIMIX_simcall_pre(smx_simcall_t simcall, int value)
 {
   XBT_DEBUG("Handling simcall %p: %s", simcall, SIMIX_simcall_name(simcall->call));
-  simcall->mc_value = value;
+  SIMCALL_SET_MC_VALUE(simcall, value);
+  if (simcall->issuer->context->iwannadie && simcall->call != SIMCALL_PROCESS_CLEANUP)
+    return;
   switch (simcall->call) {
-SIMCALL_LIST(SIMCALL_CASE, SIMCALL_SEP_NOTHING)
-    case NUM_SIMCALLS:;
+#include "simcalls_generated_case.c"
+    case NUM_SIMCALLS:
       break;
-    case SIMCALL_NONE:;
+    case SIMCALL_NONE:
       THROWF(arg_error,0,"Asked to do the noop syscall on %s@%s",
           SIMIX_process_get_name(simcall->issuer),
           SIMIX_host_get_name(SIMIX_process_get_host(simcall->issuer))
@@ -86,6 +96,10 @@ void SIMIX_simcall_post(smx_action_t action)
       SIMIX_post_process_sleep(action);
       break;
 
+    case SIMIX_ACTION_JOIN:
+      SIMIX_post_process_sleep(action);
+      break;
+
     case SIMIX_ACTION_SYNCHRO:
       SIMIX_post_synchro(action);
       break;
@@ -110,7 +124,7 @@ void SIMIX_simcall_post(smx_action_t action)
 /* FIXME find a way to make this work
 simcall_handler_t simcall_table[NUM_SIMCALLS] = {
 #undef SIMCALL_ENUM_ELEMENT
-#define SIMCALL_ENUM_ELEMENT(x,y) &y // generate strings from the enumeration values 
+#define SIMCALL_ENUM_ELEMENT(x,y) &y // generate strings from the enumeration values
 SIMCALL_LIST
 #undef SIMCALL_ENUM_ELEMENT
 };*/
@@ -129,20 +143,3 @@ SIMCALL_LIST
 #undef SIMCALL_ENUM_ELEMENT
 };*/
 
-smx_simcall_t __SIMIX_simcall(e_smx_simcall_t simcall_id, u_smx_scalar_t *args)
-{
-  smx_process_t self = SIMIX_process_self();
-  self->simcall.call = simcall_id;
-  self->simcall.args = args;
-
-  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_pre(&self->simcall, 0);
-  }
-  return &(self->simcall);
-}