Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Bugfix: no longer post a request in the clean up function.
authorcristianrosa <cristianrosa@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Tue, 11 Jan 2011 13:30:36 +0000 (13:30 +0000)
committercristianrosa <cristianrosa@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Tue, 11 Jan 2011 13:30:36 +0000 (13:30 +0000)
Assume the process being killed is "self".

git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@9395 48e7efb5-ca39-0410-a469-dd3cf9ba447f

src/msg/m_process.c

index 2dcb16f..ea8faa6 100644 (file)
@@ -28,12 +28,21 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(msg_process, msg,
 /******************************** Process ************************************/
 void __MSG_process_cleanup(smx_process_t smx_proc)
 {
 /******************************** Process ************************************/
 void __MSG_process_cleanup(smx_process_t smx_proc)
 {
-  /* arg is a pointer to a simix process, we can get the msg process with the field data */
-  m_process_t proc = SIMIX_req_process_get_data(smx_proc);
+  /* This function should be always be executed by the process being
+   * cleaned up */
+  if(smx_proc != SIMIX_process_self())
+    THROW_IMPOSSIBLE;
+
+  /* arg is no longer used, just kept to avoid changing the interface */
+  m_process_t proc = SIMIX_process_self_get_data();
+
 #ifdef HAVE_TRACING
   TRACE_msg_process_end(proc);
 #endif
 #ifdef HAVE_TRACING
   TRACE_msg_process_end(proc);
 #endif
-  xbt_fifo_remove(msg_global->process_list, proc);
+
+  if(msg_global)
+    xbt_fifo_remove(msg_global->process_list, proc);
+
   SIMIX_process_cleanup(smx_proc);
   if (proc->name) {
     free(proc->name);
   SIMIX_process_cleanup(smx_proc);
   if (proc->name) {
     free(proc->name);