/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
+#include <xbt/ex.hpp>
+
#include "jmsg_process.h"
#include "jmsg.h"
jfieldID jprocess_field_Process_pid;
jfieldID jprocess_field_Process_ppid;
-JNIEXPORT void JNICALL
-Java_org_simgrid_msg_Process_exit(JNIEnv *env, jobject jprocess) {
-
-}
-
jobject native_to_java_process(msg_process_t process)
{
- simgrid::java::JavaContext* context = (simgrid::java::JavaContext*) MSG_process_get_smx_ctx(process);
+ simgrid::kernel::context::JavaContext* context = (simgrid::kernel::context::JavaContext*) MSG_process_get_smx_ctx(process);
return context->jprocess;
}
void jprocess_join(jobject jprocess, JNIEnv * env)
{
msg_process_t process = jprocess_to_native_process(jprocess,env);
- simgrid::java::JavaContext* context = (simgrid::java::JavaContext*) MSG_process_get_smx_ctx(process);
+ simgrid::kernel::context::JavaContext* context = (simgrid::kernel::context::JavaContext*) MSG_process_get_smx_ctx(process);
xbt_os_thread_join(context->thread,nullptr);
}
jdouble jkill = env->GetDoubleField(jprocess, jprocess_field_Process_killTime);
/* Actually build the MSG process */
process = MSG_process_create_with_environment(name, [](int argc, char** argv) -> int {
- smx_process_t process = SIMIX_process_self();
+ smx_actor_t process = SIMIX_process_self();
// This is the jprocess passed as environment.
// It would be simplet if we could use a closure.
jobject jprocess = (jobject) MSG_process_get_data(process);
- simgrid::java::java_main_jprocess(jprocess);
- return;
+ simgrid::kernel::context::java_main_jprocess(jprocess);
+ return 0;
}, jprocess,
host,
/*argc, argv, properties*/
return;
}
- MSG_process_kill(process);
+ try {
+ MSG_process_kill(process);
+ } catch (xbt_ex& ex) {
+ XBT_VERB("This process just killed itself.");
+ }
}
JNIEXPORT void JNICALL Java_org_simgrid_msg_Process_migrate(JNIEnv * env, jobject jprocess, jobject jhost)
return (jint) MSG_process_get_number();
}
-}
+} // extern C