Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Yet some more cleanups in ruby (and this time, I go to bed)
[simgrid.git] / src / bindings / ruby / rb_msg_process.c
index 505b8a2..b0bd1ee 100644 (file)
@@ -89,19 +89,17 @@ void rb_process_bind(VALUE ruby_process,m_process_t process) {
 
 
 // processCreate
+// FIXME: don't mess with MSG internals here, use MSG_process_create_with_arguments()
 
 void rb_process_create(VALUE class,VALUE ruby_process,VALUE host) {
-  VALUE rbName;      // Name of Java Process instance
+  VALUE rbName;      // Name of ruby Process instance
   m_process_t process; // Native Process to Create
   const char * name ; // Name of C Native Process
-  char alias[MAX_ALIAS_NAME + 1 ] = {0};
-  msg_mailbox_t mailbox;
   rbName = rb_process_getName(ruby_process);
 
-  if(!rbName) {
-    rb_raise(rb_eRuntimeError,"Internal error : Process Name Cannot be NULL");
-    return;
-  }
+  if(!rbName)
+    rb_raise(rb_eRuntimeError,"Internal error: Process name cannot be NULL");
+
   // Allocate the data for the simulation
   process = xbt_new0(s_m_process_t,1);
   process->simdata = xbt_new0(s_simdata_process_t,1);
@@ -112,13 +110,11 @@ void rb_process_create(VALUE class,VALUE ruby_process,VALUE host) {
   process->name = xbt_strdup(name);
   Data_Get_Struct(host,s_m_host_t,process->simdata->m_host);
 
-  if(!(process->simdata->m_host)) // Not Binded
-  {
+  if(!(process->simdata->m_host)) { // Not Binded
     free(process->simdata);
     free(process->data);
     free(process);
-    rb_raise(rb_eRuntimeError,"Host not bound...while creating native process");
-    return;
+    rb_raise(rb_eRuntimeError,"Host not bound while creating native process");
   }
   process->simdata->PID = msg_global->PID++; //  msg_global ??
 
@@ -138,23 +134,16 @@ void rb_process_create(VALUE class,VALUE ruby_process,VALUE host) {
           process->simdata->m_host->simdata->smx_host->name,
           1,argv,NULL);
 
- DEBUG1("context created (s_process=%p)",process->simdata->s_process);
 DEBUG1("context created (s_process=%p)",process->simdata->s_process);
 
   if (SIMIX_process_self()) { // SomeOne Created Me !!
     process->simdata->PPID = MSG_process_get_PID(SIMIX_process_self()->data);
-  }
-  else
-  {
+  } else {
     process->simdata->PPID = -1;
   }
   process->simdata->last_errno = MSG_OK;
   // let's Add the Process to the list of the Simulation's Processes
   xbt_fifo_unshift(msg_global->process_list,process);
-  sprintf(alias,"%s:%s",(process->simdata->m_host->simdata->smx_host)->name,
-      process->name);
-
-  mailbox = MSG_mailbox_new(alias);
-
 }