Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Reorganizing and cleaning the doc
[simgrid.git] / src / msg / m_process.c
index 5f586cc..50bd95c 100644 (file)
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(m_process, msg,
                                "Logging specific to MSG (process)");
 
+/** \defgroup m_process_management Management Functions of Agents
+ *  \brief This section describes the agent structure of MSG
+ *  (#m_process_t) and the functions for managing it.
+ *
+ *  We need to simulate many independent scheduling decisions, so
+ *  the concept of <em>process</em> is at the heart of the
+ *  simulator. A process may be defined as a <em>code</em>, with
+ *  some <em>private data</em>, executing in a <em>location</em>.
+ *  \see m_process_t
+ */
+
 /******************************** Process ************************************/
 /** \ingroup m_process_management
  * \brief Creates and runs a new #m_process_t.
@@ -29,6 +40,10 @@ m_process_t MSG_process_create(const char *name,
 static void MSG_process_cleanup(void *arg)
 {
 
+  while(((m_process_t)arg)->simdata->paje_state) {
+    PAJE_PROCESS_POP_STATE((m_process_t)arg);
+  }
+
   PAJE_PROCESS_FREE(arg);
 
   xbt_fifo_remove(msg_global->process_list, arg);
@@ -320,7 +335,6 @@ MSG_error_t MSG_process_suspend(m_process_t process)
 
   xbt_assert0(((process) && (process->simdata)), "Invalid parameters");
 
-  //  PAJE_PROCESS_STATE(process,"S");
   PAJE_PROCESS_PUSH_STATE(process,"S");
 
   if(process!=MSG_process_self()) {
@@ -376,7 +390,6 @@ MSG_error_t MSG_process_resume(m_process_t process)
 
 
   if(simdata->blocked) {
-    //    PAJE_PROCESS_STATE(process,"B");
     PAJE_PROCESS_POP_STATE(process);
 
     simdata->suspended = 0; /* He'll wake up by itself */
@@ -393,10 +406,8 @@ MSG_error_t MSG_process_resume(m_process_t process)
   if(simdata_task->compute) {
     surf_workstation_resource->common_public->resume(simdata_task->compute);
     PAJE_PROCESS_POP_STATE(process);
-    //    PAJE_PROCESS_STATE(process,"E");
   }
   else {
-    //    PAJE_PROCESS_STATE(process,"C");
     PAJE_PROCESS_POP_STATE(process);
     surf_workstation_resource->common_public->resume(simdata_task->comm);
   }
@@ -424,7 +435,6 @@ MSG_error_t __MSG_process_block(void)
   m_task_t dummy = MSG_TASK_UNINITIALIZED;
   dummy = MSG_task_create("blocked", 0.0, 0, NULL);
   
-  //  PAJE_PROCESS_STATE(process,"B");
   PAJE_PROCESS_PUSH_STATE(process,"B");
 
   process->simdata->blocked=1;