/* Functions related to the java task instances. */
-/* Copyright (c) 2007-2019. The SimGrid Team. All rights reserved. */
+/* Copyright (c) 2007-2020. 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. */
}
JNIEXPORT jstring JNICALL Java_org_simgrid_msg_Task_getName(JNIEnv * env, jobject jtask) {
- msg_task_t task = jtask_to_native(jtask, env);
+ const_msg_task_t task = jtask_to_native(jtask, env);
if (not task) {
jxbt_throw_notbound(env, "task", jtask);
}
JNIEXPORT jobject JNICALL Java_org_simgrid_msg_Task_getSender(JNIEnv * env, jobject jtask) {
- msg_process_t process;
-
- msg_task_t task = jtask_to_native(jtask, env);
+ const_msg_task_t task = jtask_to_native(jtask, env);
if (not task) {
jxbt_throw_notbound(env, "task", jtask);
return nullptr;
}
- process = MSG_task_get_sender(task);
+ auto const* process = MSG_task_get_sender(task);
if (process == nullptr) {
return nullptr;
}
JNIEXPORT jobject JNICALL Java_org_simgrid_msg_Task_getSource(JNIEnv * env, jobject jtask)
{
- msg_host_t host;
- msg_task_t task = jtask_to_native(jtask, env);
+ const_msg_task_t task = jtask_to_native(jtask, env);
if (not task) {
jxbt_throw_notbound(env, "task", jtask);
return nullptr;
}
- host = MSG_task_get_source(task);
+ auto const* host = MSG_task_get_source(task);
if (host == nullptr) {
return nullptr;
}
JNIEXPORT jdouble JNICALL Java_org_simgrid_msg_Task_getFlopsAmount(JNIEnv * env, jobject jtask)
{
- msg_task_t ptask = jtask_to_native(jtask, env);
+ const_msg_task_t ptask = jtask_to_native(jtask, env);
if (not ptask) {
jxbt_throw_notbound(env, "task", jtask);
msg_task_t task = nullptr;
const char *alias = env->GetStringUTFChars(jalias, 0);
- msg_error_t res = MSG_task_receive_ext_bounded(&task, alias, jtimeout, /*host*/ nullptr, rate);
+ msg_error_t res = MSG_task_receive_with_timeout_bounded(&task, alias, jtimeout, rate);
if (env->ExceptionOccurred())
return nullptr;
if (res != MSG_OK) {