Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
add Process.daemonize to the Java bindings
authorFrederic Suter <frederic.suter@cc.in2p3.fr>
Wed, 22 Nov 2017 00:29:06 +0000 (01:29 +0100)
committerFrederic Suter <frederic.suter@cc.in2p3.fr>
Wed, 22 Nov 2017 00:29:06 +0000 (01:29 +0100)
(and call s4u equivalent from MSG directly)

src/bindings/java/jmsg_process.cpp
src/bindings/java/jmsg_process.h
src/msg/msg_process.cpp

index ad3f399..1d4b58e 100644 (file)
@@ -91,6 +91,18 @@ JNIEXPORT void JNICALL Java_org_simgrid_msg_Process_create(JNIEnv* env, jobject
   env->SetIntField(jprocess, jprocess_field_Process_ppid, (jint) MSG_process_get_PPID(process));
 }
 
+JNIEXPORT void JNICALL Java_org_simgrid_msg_Process_daemonize(JNIEnv* env, jobject jprocess)
+{
+  msg_process_t process = jprocess_to_native(jprocess, env);
+
+  if (not process) {
+    jxbt_throw_notbound(env, "process", jprocess);
+    return;
+  }
+
+  MSG_process_daemonize(process);
+}
+
 JNIEXPORT jint JNICALL Java_org_simgrid_msg_Process_killAll(JNIEnv * env, jclass cls, jint jresetPID)
 {
   return (jint) MSG_process_killall((int) jresetPID);
index f771824..597f5b2 100644 (file)
@@ -47,6 +47,7 @@ JNIEXPORT void JNICALL Java_org_simgrid_msg_Process_nativeInit(JNIEnv *env, jcla
 /* Implement the Java API */
 
 JNIEXPORT void JNICALL Java_org_simgrid_msg_Process_create(JNIEnv* env, jobject jprocess_arg, jobject jhostname);
+JNIEXPORT void JNICALL Java_org_simgrid_msg_Process_daemonize(JNIEnv* env, jobject jprocess);
 JNIEXPORT jint JNICALL Java_org_simgrid_msg_Process_killAll(JNIEnv* env, jclass cls, jint jresetPID);
 JNIEXPORT jobject JNICALL Java_org_simgrid_msg_Process_fromPID(JNIEnv* env, jclass cls, jint pid);
 JNIEXPORT jobject JNICALL Java_org_simgrid_msg_Process_getProperty(JNIEnv* env, jobject jprocess, jobject jname);
index b667569..8af7ea5 100644 (file)
@@ -507,7 +507,7 @@ XBT_PUBLIC(msg_process_t) MSG_process_restart(msg_process_t process) {
  */
 XBT_PUBLIC(void) MSG_process_daemonize(msg_process_t process)
 {
-  simgrid::simix::kernelImmediate([process]() { process->getImpl()->daemonize(); });
+  process->daemonize();
 }
 
 /** @ingroup m_process_management