Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Now that processes are terminated cleanly, this recv can fail
authorChristophe Thiéry <christopho128@gmail.com>
Fri, 14 Oct 2011 15:54:51 +0000 (17:54 +0200)
committerChristophe Thiéry <christopho128@gmail.com>
Fri, 14 Oct 2011 15:54:51 +0000 (17:54 +0200)
examples/msg/actions/actions.c

index a45db1f..ca75da4 100644 (file)
@@ -137,10 +137,13 @@ static void action_recv(const char *const *action)
 #endif
 
   XBT_DEBUG("Receiving: %s", name);
 #endif
 
   XBT_DEBUG("Receiving: %s", name);
-  MSG_task_receive(&task, mailbox_name);
+  MSG_error_t res = MSG_task_receive(&task, mailbox_name);
   //  MSG_task_receive(&task, MSG_process_get_name(MSG_process_self()));
   XBT_VERB("%s %f", name, MSG_get_clock() - clock);
   //  MSG_task_receive(&task, MSG_process_get_name(MSG_process_self()));
   XBT_VERB("%s %f", name, MSG_get_clock() - clock);
-  MSG_task_destroy(task);
+
+  if (res == MSG_OK) {
+    MSG_task_destroy(task);
+  }
 
   if (XBT_LOG_ISENABLED(actions, xbt_log_priority_verbose))
     free(name);
 
   if (XBT_LOG_ISENABLED(actions, xbt_log_priority_verbose))
     free(name);