/* Functions related to the java task instances. */
-/* Copyright (c) 2007, 2009-2010, 2013-2015. The SimGrid Team.
- * All rights reserved. */
+/* Copyright (c) 2007-2019. The SimGrid Team. All rights reserved. */
/* 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/log.h>
-#include <xbt/str.h>
-#include <xbt/sysdep.h>
+#include "simgrid/s4u/Host.hpp"
+#include "src/kernel/context/Context.hpp"
-#include <simgrid/msg.h>
-#include <simgrid/s4u/host.hpp>
-
-#include "jmsg.h"
+#include "jmsg.hpp"
#include "jmsg_host.h"
-#include "jmsg_task.h"
#include "jmsg_process.h"
-#include "jxbt_utilities.h"
+#include "jmsg_task.h"
+#include "jxbt_utilities.hpp"
-XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(jmsg);
+XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(java);
static jmethodID jtask_method_Comm_constructor;
env->SetLongField(jtask, jtask_field_Task_bind, (intptr_t)task);
}
-msg_task_t jtask_to_native_task(jobject jtask, JNIEnv * env)
+msg_task_t jtask_to_native(jobject jtask, JNIEnv* env)
{
return (msg_task_t)(intptr_t)env->GetLongField(jtask, jtask_field_Task_bind);
}
-jboolean jtask_is_valid(jobject jtask, JNIEnv * env)
-{
- return env->GetLongField(jtask, jtask_field_Task_bind) ? JNI_TRUE : JNI_FALSE;
-}
-
JNIEXPORT void JNICALL Java_org_simgrid_msg_Task_nativeInit(JNIEnv *env, jclass cls) {
jclass jtask_class_Comm = env->FindClass("org/simgrid/msg/Comm");
jclass jtask_class_Task = env->FindClass("org/simgrid/msg/Task");
JNIEXPORT void JNICALL Java_org_simgrid_msg_Task_create(JNIEnv * env, jobject jtask, jstring jname,
jdouble jflopsAmount, jdouble jbytesAmount)
{
- msg_task_t task; /* the native task to create */
const char *name = nullptr; /* the name of the task */
- if (jflopsAmount < 0) {
- jxbt_throw_illegal(env, bprintf("Task flopsAmount (%f) cannot be negative", (double) jflopsAmount));
- return;
- }
-
- if (jbytesAmount < 0) {
- jxbt_throw_illegal(env, bprintf("Task bytesAmount (%f) cannot be negative", (double) jbytesAmount));
- return;
- }
-
- if (jname) {
- /* get the C string from the java string */
+ if (jname)
name = env->GetStringUTFChars(jname, 0);
- }
-
- /* create the task */
- task = MSG_task_create(name, (double) jflopsAmount, (double) jbytesAmount, nullptr);
+ msg_task_t task = MSG_task_create(name, static_cast<double>(jflopsAmount), static_cast<double>(jbytesAmount), jtask);
if (jname)
env->ReleaseStringUTFChars(jname, name);
- /* sets the task name */
- env->SetObjectField(jtask, jtask_field_Task_name, jname);
+
/* bind & store the task */
jtask_bind(jtask, task, env);
- MSG_task_set_data(task, jtask);
}
JNIEXPORT void JNICALL Java_org_simgrid_msg_Task_parallelCreate(JNIEnv * env, jobject jtask, jstring jname,
jobjectArray jhosts, jdoubleArray jcomputeDurations_arg,
jdoubleArray jmessageSizes_arg)
{
- msg_task_t task; /* the native parallel task to create */
- const char *name; /* the name of the task */
- int host_count;
- msg_host_t *hosts;
- double *computeDurations;
- double *messageSizes;
- jdouble *jcomputeDurations;
- jdouble *jmessageSizes;
- jobject jhost;
- int index;
-
- if (!jcomputeDurations_arg) {
- jxbt_throw_null(env, xbt_strdup("Parallel task flops amounts cannot be null"));
- return;
- }
-
- if (!jmessageSizes_arg) {
- jxbt_throw_null(env, xbt_strdup("Parallel task bytes amounts cannot be null"));
- return;
- }
+ int host_count = static_cast<int>(env->GetArrayLength(jhosts));
- if (!jname) {
- jxbt_throw_null(env, xbt_strdup("Parallel task name cannot be null"));
- return;
- }
-
- host_count = (int) env->GetArrayLength(jhosts);
-
- hosts = xbt_new0(msg_host_t, host_count);
- computeDurations = xbt_new0(double, host_count);
- messageSizes = xbt_new0(double, host_count * host_count);
-
- jcomputeDurations = env->GetDoubleArrayElements(jcomputeDurations_arg, 0);
- jmessageSizes = env->GetDoubleArrayElements(jmessageSizes_arg, 0);
-
- for (index = 0; index < host_count; index++) {
- jhost = env->GetObjectArrayElement(jhosts, index);
+ jdouble* jcomputeDurations = env->GetDoubleArrayElements(jcomputeDurations_arg, 0);
+ msg_host_t* hosts = new msg_host_t[host_count];
+ double* computeDurations = new double[host_count];
+ for (int index = 0; index < host_count; index++) {
+ jobject jhost = env->GetObjectArrayElement(jhosts, index);
hosts[index] = jhost_get_native(env, jhost);
computeDurations[index] = jcomputeDurations[index];
}
- for (index = 0; index < host_count * host_count; index++) {
+ env->ReleaseDoubleArrayElements(jcomputeDurations_arg, jcomputeDurations, 0);
+
+ jdouble* jmessageSizes = env->GetDoubleArrayElements(jmessageSizes_arg, 0);
+ double* messageSizes = new double[host_count * host_count];
+ for (int index = 0; index < host_count * host_count; index++) {
messageSizes[index] = jmessageSizes[index];
}
-
- env->ReleaseDoubleArrayElements(jcomputeDurations_arg, jcomputeDurations, 0);
env->ReleaseDoubleArrayElements(jmessageSizes_arg, jmessageSizes, 0);
/* get the C string from the java string */
- name = env->GetStringUTFChars(jname, 0);
-
- task = MSG_parallel_task_create(name, host_count, hosts, computeDurations, messageSizes, nullptr);
-
+ const char* name = env->GetStringUTFChars(jname, 0);
+ msg_task_t task = MSG_parallel_task_create(name, host_count, hosts, computeDurations, messageSizes, jtask);
env->ReleaseStringUTFChars(jname, name);
- /* sets the task name */
- env->SetObjectField(jtask, jtask_field_Task_name, jname);
+
/* associate the java task object and the native task */
jtask_bind(jtask, task, env);
- MSG_task_set_data(task, (void *) jtask);
-
- if (!MSG_task_get_data(task))
- jxbt_throw_jni(env, "global ref allocation failed");
+ delete[] hosts;
+ delete[] computeDurations;
+ delete[] messageSizes;
}
JNIEXPORT void JNICALL Java_org_simgrid_msg_Task_cancel(JNIEnv * env, jobject jtask)
{
- msg_task_t ptask = jtask_to_native_task(jtask, env);
+ msg_task_t ptask = jtask_to_native(jtask, env);
- if (!ptask) {
+ if (not ptask) {
jxbt_throw_notbound(env, "task", jtask);
return;
}
msg_error_t rv = MSG_task_cancel(ptask);
- jxbt_check_res("MSG_task_cancel()", rv, MSG_OK, bprintf("unexpected error , please report this bug"));
+ jxbt_check_res("MSG_task_cancel()", rv, MSG_OK, "unexpected error , please report this bug");
}
JNIEXPORT void JNICALL Java_org_simgrid_msg_Task_execute(JNIEnv * env, jobject jtask)
{
- msg_task_t task = jtask_to_native_task(jtask, env);
+ msg_task_t task = jtask_to_native(jtask, env);
- if (!task) {
+ if (not task) {
jxbt_throw_notbound(env, "task", jtask);
return;
}
msg_error_t rv;
- rv = MSG_task_execute(task);
+ simgrid::kernel::context::try_n_catch_stoprequest(
+ [&rv, &task]() { rv = MSG_task_execute(task); },
+ [&env] { jxbt_throw_by_name(env, "org/simgrid/msg/ProcessKilledError", "Process killed"); });
+
if (env->ExceptionOccurred())
return;
if (rv != MSG_OK) {
JNIEXPORT void JNICALL Java_org_simgrid_msg_Task_setBound(JNIEnv * env, jobject jtask, jdouble bound)
{
- msg_task_t task = jtask_to_native_task(jtask, env);
+ msg_task_t task = jtask_to_native(jtask, env);
- if (!task) {
+ if (not task) {
jxbt_throw_notbound(env, "task", jtask);
return;
}
}
JNIEXPORT jstring JNICALL Java_org_simgrid_msg_Task_getName(JNIEnv * env, jobject jtask) {
- msg_task_t task = jtask_to_native_task(jtask, env);
+ msg_task_t task = jtask_to_native(jtask, env);
- if (!task) {
+ if (not task) {
jxbt_throw_notbound(env, "task", jtask);
return nullptr;
}
JNIEXPORT jobject JNICALL Java_org_simgrid_msg_Task_getSender(JNIEnv * env, jobject jtask) {
msg_process_t process;
- msg_task_t task = jtask_to_native_task(jtask, env);
+ msg_task_t task = jtask_to_native(jtask, env);
- if (!task) {
+ if (not task) {
jxbt_throw_notbound(env, "task", jtask);
return nullptr;
}
if (process == nullptr) {
return nullptr;
}
- return (jobject) native_to_java_process(process);
+ return (jobject)jprocess_from_native(process);
}
JNIEXPORT jobject JNICALL Java_org_simgrid_msg_Task_getSource(JNIEnv * env, jobject jtask)
{
msg_host_t host;
- msg_task_t task = jtask_to_native_task(jtask, env);
+ msg_task_t task = jtask_to_native(jtask, env);
- if (!task) {
+ if (not task) {
jxbt_throw_notbound(env, "task", jtask);
return nullptr;
}
if (host == nullptr) {
return nullptr;
}
- if (!host->extension(JAVA_HOST_LEVEL)) {
+ if (not host->extension(JAVA_HOST_LEVEL)) {
jxbt_throw_jni(env, "MSG_task_get_source() failed");
return nullptr;
}
JNIEXPORT jdouble JNICALL Java_org_simgrid_msg_Task_getFlopsAmount(JNIEnv * env, jobject jtask)
{
- msg_task_t ptask = jtask_to_native_task(jtask, env);
+ msg_task_t ptask = jtask_to_native(jtask, env);
- if (!ptask) {
+ if (not ptask) {
jxbt_throw_notbound(env, "task", jtask);
return -1;
}
- return (jdouble) MSG_task_get_flops_amount(ptask);
+ return (jdouble)MSG_task_get_flops_amount(ptask);
}
JNIEXPORT void JNICALL Java_org_simgrid_msg_Task_setName(JNIEnv *env, jobject jtask, jobject jname) {
- msg_task_t task = jtask_to_native_task(jtask, env);
+ msg_task_t task = jtask_to_native(jtask, env);
- if (!task) {
+ if (not task) {
jxbt_throw_notbound(env, "task", jtask);
return;
}
JNIEXPORT void JNICALL Java_org_simgrid_msg_Task_setPriority(JNIEnv * env, jobject jtask, jdouble priority)
{
- msg_task_t task = jtask_to_native_task(jtask, env);
+ msg_task_t task = jtask_to_native(jtask, env);
- if (!task) {
+ if (not task) {
jxbt_throw_notbound(env, "task", jtask);
return;
}
- MSG_task_set_priority(task, (double) priority);
+ MSG_task_set_priority(task, static_cast<double>(priority));
}
JNIEXPORT void JNICALL Java_org_simgrid_msg_Task_setFlopsAmount (JNIEnv *env, jobject jtask, jdouble computationAmount)
{
- msg_task_t task = jtask_to_native_task(jtask, env);
+ msg_task_t task = jtask_to_native(jtask, env);
- if (!task) {
+ if (not task) {
jxbt_throw_notbound(env, "task", jtask);
return;
}
- MSG_task_set_flops_amount(task, (double) computationAmount);
+ MSG_task_set_flops_amount(task, static_cast<double>(computationAmount));
}
JNIEXPORT void JNICALL Java_org_simgrid_msg_Task_setBytesAmount (JNIEnv *env, jobject jtask, jdouble dataSize)
{
- msg_task_t task = jtask_to_native_task(jtask, env);
+ msg_task_t task = jtask_to_native(jtask, env);
- if (!task) {
+ if (not task) {
jxbt_throw_notbound(env, "task", jtask);
return;
}
env->SetDoubleField(jtask, jtask_field_Task_messageSize, dataSize);
- MSG_task_set_bytes_amount(task, (double) dataSize);
-}
-
-JNIEXPORT void JNICALL Java_org_simgrid_msg_Task_send(JNIEnv * env,jobject jtask, jstring jalias, jdouble jtimeout)
-{
- msg_error_t rv;
- const char *alias = env->GetStringUTFChars(jalias, 0);
-
- msg_task_t task = jtask_to_native_task(jtask, env);
-
- if (!task) {
- env->ReleaseStringUTFChars(jalias, alias);
- jxbt_throw_notbound(env, "task", jtask);
- return;
- }
-
- /* Pass a global ref to the Jtask into the Ctask so that the receiver can use it */
- MSG_task_set_data(task, (void *) env->NewGlobalRef(jtask));
- rv = MSG_task_send_with_timeout(task, alias, (double) jtimeout);
- env->ReleaseStringUTFChars(jalias, alias);
-
- if (rv != MSG_OK) {
- jmsg_throw_status(env, rv);
- }
+ MSG_task_set_bytes_amount(task, static_cast<double>(dataSize));
}
JNIEXPORT void JNICALL Java_org_simgrid_msg_Task_sendBounded(JNIEnv * env,jobject jtask, jstring jalias,
jdouble jtimeout,jdouble maxrate)
{
- msg_error_t rv;
- const char *alias = env->GetStringUTFChars(jalias, 0);
-
- msg_task_t task = jtask_to_native_task(jtask, env);
-
- if (!task) {
- env->ReleaseStringUTFChars(jalias, alias);
+ msg_task_t task = jtask_to_native(jtask, env);
+ if (not task) {
jxbt_throw_notbound(env, "task", jtask);
return;
}
- /* Pass a global ref to the Jtask into the Ctask so that the receiver can use it */
+ /* Add a global ref into the Ctask so that the receiver can use it */
MSG_task_set_data(task, (void *) env->NewGlobalRef(jtask));
- rv = MSG_task_send_with_timeout_bounded(task, alias, (double) jtimeout, (double) maxrate);
+
+ const char* alias = env->GetStringUTFChars(jalias, 0);
+ msg_error_t res =
+ MSG_task_send_with_timeout_bounded(task, alias, static_cast<double>(jtimeout), static_cast<double>(maxrate));
env->ReleaseStringUTFChars(jalias, alias);
- if (rv != MSG_OK) {
- jmsg_throw_status(env, rv);
- }
+ if (res != MSG_OK)
+ jmsg_throw_status(env, res);
}
-JNIEXPORT jobject JNICALL Java_org_simgrid_msg_Task_receive(JNIEnv * env, jclass cls, jstring jalias, jdouble jtimeout,
- jobject jhost)
+JNIEXPORT jobject JNICALL Java_org_simgrid_msg_Task_receive(JNIEnv* env, jclass cls, jstring jalias, jdouble jtimeout)
{
msg_task_t task = nullptr;
- msg_host_t host = nullptr;
- jobject jtask_global, jtask_local;
-
- if (jhost) {
- host = jhost_get_native(env, jhost);
-
- if (!host) {
- jxbt_throw_notbound(env, "host", jhost);
- return nullptr;
- }
- }
-
const char *alias = env->GetStringUTFChars(jalias, 0);
- msg_error_t rv = MSG_task_receive_ext(&task, alias, (double) jtimeout, host);
+ msg_error_t rv;
+ simgrid::kernel::context::try_n_catch_stoprequest(
+ [&rv, &task, &alias, &jtimeout]() {
+ rv = MSG_task_receive_ext(&task, alias, (double)jtimeout, /*host*/ nullptr);
+ },
+ [&env]() { jxbt_throw_by_name(env, "org/simgrid/msg/ProcessKilledError", "Process killed"); });
+ env->ReleaseStringUTFChars(jalias, alias);
if (env->ExceptionOccurred())
return nullptr;
if (rv != MSG_OK) {
- jmsg_throw_status(env,rv);
+ jmsg_throw_status(env, rv);
return nullptr;
}
- jtask_global = (jobject) MSG_task_get_data(task);
+ jobject jtask_global = (jobject) MSG_task_get_data(task);
/* Convert the global ref into a local ref so that the JVM can free the stuff */
- jtask_local = env->NewLocalRef(jtask_global);
+ jobject jtask_local = env->NewLocalRef(jtask_global);
env->DeleteGlobalRef(jtask_global);
MSG_task_set_data(task, nullptr);
- env->ReleaseStringUTFChars(jalias, alias);
-
return (jobject) jtask_local;
}
JNIEXPORT jobject JNICALL Java_org_simgrid_msg_Task_irecv(JNIEnv * env, jclass cls, jstring jmailbox) {
jclass comm_class = env->FindClass("org/simgrid/msg/Comm");
- if (!comm_class)
+ if (not comm_class)
return nullptr;
//pointer to store the task object pointer.
- msg_task_t *task = xbt_new(msg_task_t,1);
- *task = nullptr;
+ msg_task_t* task = new msg_task_t(nullptr);
/* There should be a cache here */
jobject jcomm = env->NewObject(comm_class, jtask_method_Comm_constructor);
- if (!jcomm) {
+ if (not jcomm) {
jxbt_throw_jni(env, "Can't create a Comm object.");
return nullptr;
}
return jcomm;
}
-JNIEXPORT jobject JNICALL Java_org_simgrid_msg_Task_receiveBounded(JNIEnv * env, jclass cls, jstring jalias,
- jdouble jtimeout, jobject jhost, jdouble rate)
+JNIEXPORT jobject JNICALL Java_org_simgrid_msg_Task_receiveBounded(JNIEnv* env, jclass cls, jstring jalias,
+ jdouble jtimeout, jdouble rate)
{
- msg_error_t rv;
- msg_task_t *task = xbt_new(msg_task_t,1);
- *task = nullptr;
-
- msg_host_t host = nullptr;
- jobject jtask_global, jtask_local;
- const char *alias;
-
- if (jhost) {
- host = jhost_get_native(env, jhost);
-
- if (!host) {
- jxbt_throw_notbound(env, "host", jhost);
- return nullptr;
- }
- }
+ msg_task_t task = nullptr;
- alias = env->GetStringUTFChars(jalias, 0);
- rv = MSG_task_receive_ext_bounded(task, alias, (double) jtimeout, host, (double) rate);
+ const char *alias = env->GetStringUTFChars(jalias, 0);
+ msg_error_t res = MSG_task_receive_ext_bounded(&task, alias, static_cast<double>(jtimeout), /*host*/ nullptr,
+ static_cast<double>(rate));
if (env->ExceptionOccurred())
return nullptr;
- if (rv != MSG_OK) {
- jmsg_throw_status(env,rv);
+ if (res != MSG_OK) {
+ jmsg_throw_status(env, res);
return nullptr;
}
- jtask_global = (jobject) MSG_task_get_data(*task);
+ jobject jtask_global = (jobject)MSG_task_get_data(task);
/* Convert the global ref into a local ref so that the JVM can free the stuff */
- jtask_local = env->NewLocalRef(jtask_global);
+ jobject jtask_local = env->NewLocalRef(jtask_global);
env->DeleteGlobalRef(jtask_global);
- MSG_task_set_data(*task, nullptr);
+ MSG_task_set_data(task, nullptr);
env->ReleaseStringUTFChars(jalias, alias);
- xbt_free(task);
-
return (jobject) jtask_local;
}
jdouble rate)
{
jclass comm_class = env->FindClass("org/simgrid/msg/Comm");
- if (!comm_class)
+ if (not comm_class)
return nullptr;
// pointer to store the task object pointer.
- msg_task_t* task = xbt_new0(msg_task_t, 1);
+ msg_task_t* task = new msg_task_t(nullptr);
jobject jcomm = env->NewObject(comm_class, jtask_method_Comm_constructor);
- if (!jcomm) {
+ if (not jcomm) {
jxbt_throw_jni(env, "Can't create a Comm object.");
return nullptr;
}
const char* mailbox = env->GetStringUTFChars(jmailbox, 0);
- msg_comm_t comm = MSG_task_irecv_bounded(task, mailbox, (double)rate);
+ msg_comm_t comm = MSG_task_irecv_bounded(task, mailbox, static_cast<double>(rate));
env->ReleaseStringUTFChars(jmailbox, mailbox);
env->SetLongField(jcomm, jtask_field_Comm_bind, (jlong) (uintptr_t)(comm));
jclass comm_class = env->FindClass("org/simgrid/msg/Comm");
- if (!comm_class) return nullptr;
+ if (not comm_class)
+ return nullptr;
jobject jcomm = env->NewObject(comm_class, jtask_method_Comm_constructor);
const char* mailbox = env->GetStringUTFChars(jmailbox, 0);
- msg_task_t task = jtask_to_native_task(jtask, env);
+ msg_task_t task = jtask_to_native(jtask, env);
- if (!task) {
+ if (not task) {
env->ReleaseStringUTFChars(jmailbox, mailbox);
env->DeleteLocalRef(jcomm);
jxbt_throw_notbound(env, "task", jtask);
const char *mailbox;
jclass comm_class = env->FindClass("org/simgrid/msg/Comm");
- if (!comm_class)
+ if (not comm_class)
return nullptr;
jcomm = env->NewObject(comm_class, jtask_method_Comm_constructor);
mailbox = env->GetStringUTFChars(jmailbox, 0);
- task = jtask_to_native_task(jtask, env);
+ task = jtask_to_native(jtask, env);
- if (!task) {
+ if (not task) {
env->ReleaseStringUTFChars(jmailbox, mailbox);
env->DeleteLocalRef(jcomm);
jxbt_throw_notbound(env, "task", jtask);
JNIEXPORT void JNICALL Java_org_simgrid_msg_Task_nativeFinalize(JNIEnv * env, jobject jtask)
{
- msg_task_t task = jtask_to_native_task(jtask, env);
+ msg_task_t task = jtask_to_native(jtask, env);
- if (!task) {
- jxbt_throw_notbound(env, "task", jtask);
- return;
+ if (not task) {
+ jxbt_throw_notbound(env, "task", jtask);
+ return;
}
MSG_task_destroy(task);
/* Destroy the global ref so that the JVM can free the stuff */
env->DeleteGlobalRef(jtask_global);
MSG_task_set_data(task, nullptr);
- MSG_task_destroy(task);
+ /* Don't free the C data here, to avoid a race condition with the GC also sometimes doing so.
+ * A rare memleak is seen as preferable to a rare "free(): invalid pointer" failure that
+ * proves really hard to debug.
+ */
}
JNIEXPORT void JNICALL Java_org_simgrid_msg_Task_dsend(JNIEnv * env, jobject jtask, jstring jalias)
{
const char *alias = env->GetStringUTFChars(jalias, 0);
- msg_task_t task = jtask_to_native_task(jtask, env);
+ msg_task_t task = jtask_to_native(jtask, env);
- if (!task) {
+ if (not task) {
env->ReleaseStringUTFChars(jalias, alias);
jxbt_throw_notbound(env, "task", jtask);
return;
{
const char *alias = env->GetStringUTFChars(jalias, 0);
- msg_task_t task = jtask_to_native_task(jtask, env);
+ msg_task_t task = jtask_to_native(jtask, env);
- if (!task) {
+ if (not task) {
env->ReleaseStringUTFChars(jalias, alias);
jxbt_throw_notbound(env, "task", jtask);
return;
/* Pass a global ref to the Jtask into the Ctask so that the receiver can use it */
MSG_task_set_data(task, (void *) env->NewGlobalRef(jtask));
- MSG_task_dsend_bounded(task, alias, msg_task_cancel_on_failed_dsend,(double)maxrate);
+ MSG_task_dsend_bounded(task, alias, msg_task_cancel_on_failed_dsend,static_cast<double>(maxrate));
env->ReleaseStringUTFChars(jalias, alias);
}
JNIEXPORT jboolean JNICALL Java_org_simgrid_msg_Task_listen(JNIEnv * env, jclass cls, jstring jalias)
{
- const char *alias;
- int rv;
-
- alias = env->GetStringUTFChars(jalias, 0);
- rv = MSG_task_listen(alias);
+ const char *alias = env->GetStringUTFChars(jalias, 0);
+ int rv = MSG_task_listen(alias);
env->ReleaseStringUTFChars(jalias, alias);
return (jboolean) rv;
JNIEXPORT jint JNICALL Java_org_simgrid_msg_Task_listenFrom(JNIEnv * env, jclass cls, jstring jalias)
{
- int rv;
const char *alias = env->GetStringUTFChars(jalias, 0);
- rv = MSG_task_listen_from(alias);
+ int rv = MSG_task_listen_from(alias);
env->ReleaseStringUTFChars(jalias, alias);
return (jint) rv;