Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
New function: MSG_get_process_number()
[simgrid.git] / src / msg / msg_process.c
index f511d47..ddce625 100644 (file)
@@ -45,7 +45,6 @@ void MSG_process_cleanup_from_SIMIX(smx_process_t smx_proc)
 #ifdef HAVE_TRACING
   TRACE_msg_process_end(smx_proc);
 #endif
-
   // free the data if a function was provided
   if (msg_proc->data && msg_global->process_data_cleanup) {
     msg_global->process_data_cleanup(msg_proc->data);
@@ -180,7 +179,7 @@ msg_process_t MSG_process_create_with_environment(const char *name,
 
 #ifdef HAVE_TRACING
   TRACE_msg_process_create(name, simdata->PID, simdata->m_host);
-  #endif
+#endif
   /* Let's create the process: SIMIX may decide to start it right now,
    * even before returning the flow control to us */
   simcall_process_create(&process, name, code, simdata, SIMIX_host_get_name(host->smx_host), -1,
@@ -313,6 +312,12 @@ msg_process_t MSG_process_from_PID(int PID)
 xbt_dynar_t MSG_processes_as_dynar(void) {
   return SIMIX_processes_as_dynar();
 }
+/** @brief Return the current number MSG processes.
+ */
+int MSG_process_get_number(void)
+{
+  return SIMIX_process_count();
+}
 
 /** \ingroup m_process_management
  * \brief Set the kill time of a process.
@@ -500,3 +505,10 @@ void MSG_process_on_exit(int_f_pvoid_t fun, void *data) {
 XBT_PUBLIC(void) MSG_process_auto_restart_set(msg_process_t process, int auto_restart) {
   simcall_process_auto_restart_set(process,auto_restart);
 }
+/*
+ * \ingroup m_process_management
+ * \brief Restarts a process from the beginning.
+ */
+XBT_PUBLIC(msg_process_t) MSG_process_restart(msg_process_t process) {
+  return simcall_process_restart(process);
+}