Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge java simix process creation with the standard process creation
[simgrid.git] / src / java / jmsg.c
index 0fa342b..7faed5e 100644 (file)
@@ -125,12 +125,12 @@ Java_simgrid_msg_MsgNative_processCreate(JNIEnv * env, jclass cls,
      process, process->simdata, process->simdata->m_host,
      process->simdata->m_host->simdata, env);
 
-  SIMIX_jprocess_create(process->name,
-                        process->simdata->m_host->simdata->smx_host,
-                        /*data */ (void *) process,
-                        jprocess, env, &process->simdata->s_process);
-
-
+  process->simdata->s_process = 
+    SIMIX_process_create(process->name, (xbt_main_func_t)jprocess, 
+                         /*data */ (void *) process,
+                         process->simdata->m_host->simdata->smx_host->name, 
+                         0, NULL, NULL);
+    
   DEBUG1("context created (s_process=%p)", process->simdata->s_process);
 
 
@@ -950,6 +950,7 @@ Java_simgrid_msg_Msg_init(JNIEnv * env, jclass cls, jobjectArray jargs)
 
   MSG_global_init(&argc, argv);
   MSG_set_channel_number(10);   /* FIXME: this should not be fixed statically */
+  SIMIX_context_select_factory("java");
 
   for (index = 0; index < argc; index++)
     free(argv[index]);
@@ -968,9 +969,9 @@ JNIEXPORT void JNICALL
   jobject jhost;
 
   /* Run everything */
-  if (MSG_OK != MSG_main())
+  if (MSG_OK != MSG_main()) {
     jxbt_throw_native(env, xbt_strdup("MSG_main() failed"));
-
+  }
   DEBUG0
     ("MSG_main finished. Bail out before cleanup since there is a bug in this part.");
 
@@ -985,9 +986,9 @@ JNIEXPORT void JNICALL
 
   DEBUG0("Clean native world");
   /* cleanup native stuff */
-  if (MSG_OK != MSG_clean())
+  if (MSG_OK != MSG_clean()){
     jxbt_throw_native(env, xbt_strdup("MSG_main() failed"));
-
+  }
 }
 
 JNIEXPORT jint JNICALL
@@ -1021,7 +1022,7 @@ Java_simgrid_msg_MsgNative_processExit(JNIEnv * env, jclass cls,
     return;
   }
 
-  SIMIX_context_stop(0);
+  SIMIX_context_stop(SIMIX_process_self()->context);
 }
 
 JNIEXPORT void JNICALL