Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
java: well, use a closure if you really want to
authorMartin Quinson <martin.quinson@loria.fr>
Mon, 20 Mar 2017 21:02:39 +0000 (22:02 +0100)
committerMartin Quinson <martin.quinson@loria.fr>
Mon, 20 Mar 2017 21:46:32 +0000 (22:46 +0100)
src/bindings/java/jmsg_process.cpp

index a992990..e838a68 100644 (file)
@@ -104,16 +104,9 @@ JNIEXPORT void JNICALL Java_org_simgrid_msg_Process_create(JNIEnv * env, jobject
   }
 
   /* Actually build the MSG process */
   }
 
   /* Actually build the MSG process */
-  msg_process_t process = MSG_process_create_from_stdfunc(name,
-                                                          []() -> int {
-                                                            // This is the jprocess passed as process data.
-                                                            // It would be simpler if we could use a closure.
-                                                            jobject jprocess =
-                                                                (jobject)MSG_process_get_data(MSG_process_self());
-                                                            simgrid::kernel::context::java_main_jprocess(jprocess);
-                                                            return 0;
-                                                          },
-                                                          jprocess, host, /* properties*/ nullptr);
+  msg_process_t process = MSG_process_create_from_stdfunc(
+      name, [jprocess]() -> void { simgrid::kernel::context::java_main_jprocess(jprocess); },
+      /*data*/ nullptr, host, /* properties*/ nullptr);
 
   env->ReleaseStringUTFChars(jname, name);
   /* bind the java process instance to the native process */
 
   env->ReleaseStringUTFChars(jname, name);
   /* bind the java process instance to the native process */