Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Add a function SIMIX_process_get_by_name()
authorthiery <thiery@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Tue, 15 Mar 2011 15:27:46 +0000 (15:27 +0000)
committerthiery <thiery@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Tue, 15 Mar 2011 15:27:46 +0000 (15:27 +0000)
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@9798 48e7efb5-ca39-0410-a469-dd3cf9ba447f

src/simix/process_private.h
src/simix/smx_process.c

index 5d06f2c..cb391c3 100644 (file)
@@ -70,6 +70,7 @@ void* SIMIX_process_get_data(smx_process_t process);
 void SIMIX_process_set_data(smx_process_t process, void *data);
 smx_host_t SIMIX_process_get_host(smx_process_t process);
 const char* SIMIX_process_get_name(smx_process_t process);
 void SIMIX_process_set_data(smx_process_t process, void *data);
 smx_host_t SIMIX_process_get_host(smx_process_t process);
 const char* SIMIX_process_get_name(smx_process_t process);
+smx_process_t SIMIX_process_get_by_name(const char* name);
 int SIMIX_process_is_suspended(smx_process_t process);
 xbt_dict_t SIMIX_process_get_properties(smx_process_t process);
 void SIMIX_pre_process_sleep(smx_req_t req);
 int SIMIX_process_is_suspended(smx_process_t process);
 xbt_dict_t SIMIX_process_get_properties(smx_process_t process);
 void SIMIX_pre_process_sleep(smx_req_t req);
index da17c3a..168a00f 100644 (file)
@@ -380,6 +380,18 @@ const char* SIMIX_process_get_name(smx_process_t process)
   return process->name;
 }
 
   return process->name;
 }
 
+smx_process_t SIMIX_process_get_by_name(const char* name)
+{
+  smx_process_t proc;
+
+  xbt_swag_foreach(proc, simix_global->process_list)
+  {
+    if(!strcmp(name, proc->name))
+      return proc;
+  }
+  return NULL;
+}
+
 int SIMIX_process_is_suspended(smx_process_t process)
 {
   return process->suspended;
 int SIMIX_process_is_suspended(smx_process_t process)
 {
   return process->suspended;