+ }*/\r
+\r
+ void Process::create(const Host& rHost, const char* name, int argc, char** argv)\r
+ throw(InvalidArgumentException)\r
+ {\r
+ char alias[MAX_ALIAS_NAME + 1] = {0};\r
+ msg_mailbox_t mailbox;\r
+ \r
+ \r
+ // try to retrieve the host where to createt the process from its name\r
+ m_host_t nativeHost = rHost.nativeHost;\r
+ \r
+ if(!nativeHost)\r
+ throw InvalidArgumentException("rHost"); \r
+ \r
+ /* allocate the data of the simulation */\r
+ this->nativeProcess = xbt_new0(s_m_process_t,1);\r
+ this->nativeProcess->simdata = xbt_new0(s_simdata_process_t,1);\r
+ this->nativeProcess->name = _strdup(name);\r
+ this->nativeProcess->simdata->m_host = nativeHost;\r
+ this->nativeProcess->simdata->PID = msg_global->PID++;\r
+ \r
+ // realloc the list of the argument to add the pointer to this process instance at the end\r
+ if(argc)\r
+ argv = (char**)realloc(argv , (argc + 1) * sizeof(char*));\r
+ else\r
+ argv = (char**)calloc(1 ,sizeof(char*));\r
+ \r
+ // add the pointer to this instance at the end of the list of the arguments of the process\r
+ // so the static method Process::run() (passed as argument of the MSG function xbt_context_new())\r
+ // can retrieve the concerned process object by the run\r
+ // so Process::run() can call the method main() of the good process\r
+ // for more detail see Process::run() method\r
+ argv[argc] = (char*)this;\r
+\r
+ this->nativeProcess->simdata->argc = argc;\r
+ this->nativeProcess->simdata->argv = argv;\r
+ \r
+ this->nativeProcess->simdata->s_process = SIMIX_process_create(\r
+ this->nativeProcess->name,\r
+ Process::run, \r
+ (void*)this->nativeProcess,\r
+ nativeHost->name, \r
+ argc,\r
+ argv, \r
+ NULL);\r
+ \r
+ if (SIMIX_process_self()) \r
+ {/* someone created me */\r
+ this->nativeProcess->simdata->PPID = MSG_process_get_PID((m_process_t)SIMIX_process_self()->data);\r
+ } \r
+ else \r
+ {\r
+ this->nativeProcess->simdata->PPID = -1;\r
+ }\r
+ \r
+ this->nativeProcess->simdata->last_errno = MSG_OK;\r
+ \r
+ /* add the process to the list of the processes of the simulation */\r
+ xbt_fifo_unshift(msg_global->process_list, this->nativeProcess);\r
+ \r
+ sprintf(alias,"%s:%s",(this->nativeProcess->simdata->m_host->simdata->smx_host)->name,this->nativeProcess->name);\r
+ \r
+ mailbox = MSG_mailbox_new(alias);\r
+ \r
+ MSG_mailbox_set_hostname(mailbox, this->nativeProcess->simdata->m_host->simdata->smx_host->name);\r
+\r
+ \r