Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
updating the doc
[simgrid.git] / src / msg / m_process.c
index 924f80d..2062073 100644 (file)
@@ -12,6 +12,30 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(m_process, msg,
                                "Logging specific to MSG (process)");
 
 /******************************** Process ************************************/
+/** \ingroup m_process_management
+ * \brief Creates and runs a new #m_process_t.
+ *
+ * Does exactly the same as #MSG_process_create_with_arguments but without 
+   providing standard arguments (\a argc, \a argv).
+ * \sa MSG_process_create_with_arguments
+ */
+m_process_t MSG_process_create(const char *name,
+                              m_process_code_t code, void *data,
+                              m_host_t host)
+{
+  return MSG_process_create_with_arguments(name, code, data, host, -1, NULL);
+}
+
+static void MSG_process_cleanup(void *arg)
+{
+  xbt_fifo_remove(msg_global->process_list, arg);
+  xbt_fifo_remove(msg_global->process_to_run, arg);
+  xbt_fifo_remove(((m_process_t) arg)->simdata->host->simdata->process_list, arg);
+  xbt_free(((m_process_t) arg)->name);
+  xbt_free(((m_process_t) arg)->simdata);
+  xbt_free(arg);
+}
+
 /** \ingroup m_process_management
  * \brief Creates and runs a new #m_process_t.
 
@@ -31,26 +55,11 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(m_process, msg,
    object.  It is for user-level information and can be NULL. It can
    be retrieved with the function \ref MSG_process_get_data.
  * \param host the location where the new agent is executed.
+ * \param argc first argument passed to \a code
+ * \param argv second argument passed to \a code
  * \see m_process_t
  * \return The new corresponding object.
  */
-m_process_t MSG_process_create(const char *name,
-                              m_process_code_t code, void *data,
-                              m_host_t host)
-{
-  return MSG_process_create_with_arguments(name, code, data, host, -1, NULL);
-}
-
-static void MSG_process_cleanup(void *arg)
-{
-  xbt_fifo_remove(msg_global->process_list, arg);
-  xbt_fifo_remove(msg_global->process_to_run, arg);
-  xbt_fifo_remove(((m_process_t) arg)->simdata->host->simdata->process_list, arg);
-  xbt_free(((m_process_t) arg)->name);
-  xbt_free(((m_process_t) arg)->simdata);
-  xbt_free(arg);
-}
-
 m_process_t MSG_process_create_with_arguments(const char *name,
                                              m_process_code_t code, void *data,
                                              m_host_t host, int argc, char **argv)
@@ -98,7 +107,12 @@ m_process_t MSG_process_create_with_arguments(const char *name,
   return process;
 }
 
-void MSG_process_free(m_process_t process)
+/** \ingroup m_process_management
+ * \param process poor victim
+ *
+ * This function simply kills a \a process... scarry isn't it ? :)
+ */
+void MSG_process_kill(m_process_t process)
 {
   xbt_fifo_remove(msg_global->process_list,process);
   xbt_context_free(process->simdata->context);
@@ -203,7 +217,6 @@ int MSG_process_get_PID(m_process_t process)
   return (((simdata_process_t) process->simdata)->PID);
 }
 
-
 /** \ingroup m_process_management
  * \brief Returns the process ID of the parent of \a process.
  *
@@ -360,10 +373,6 @@ int MSG_process_isSuspended(m_process_t process)
   return (process->simdata->suspended);
 }
 
-
-
-
-
 MSG_error_t __MSG_process_block(void)
 {
   m_process_t process = MSG_process_self();