/* get the native task */
m_task_t task = jtask_to_native_task(jtask_arg, env);
/* get the native task */
m_task_t task = jtask_to_native_task(jtask_arg, env);
MSG_error_t rv = MSG_task_execute(task);
jxbt_check_res("MSG_task_execute()", rv,
MSG_error_t rv = MSG_task_execute(task);
jxbt_check_res("MSG_task_execute()", rv,
bprintf("while executing task %s",
MSG_task_get_name(task)));
}
bprintf("while executing task %s",
MSG_task_get_name(task)));
}
JNIEXPORT jdouble JNICALL
Java_org_simgrid_msg_Msg_getClock(JNIEnv * env, jclass cls)
{
JNIEXPORT jdouble JNICALL
Java_org_simgrid_msg_Msg_getClock(JNIEnv * env, jclass cls)
{
argv[0] = strdup("java");
for (index = 0; index < argc - 1; index++) {
jval = (jstring) (*env)->GetObjectArrayElement(env, jargs, index);
tmp = (*env)->GetStringUTFChars(env, jval, 0);
argv[index + 1] = strdup(tmp);
argv[0] = strdup("java");
for (index = 0; index < argc - 1; index++) {
jval = (jstring) (*env)->GetObjectArrayElement(env, jargs, index);
tmp = (*env)->GetStringUTFChars(env, jval, 0);
argv[index + 1] = strdup(tmp);
- hosts = MSG_get_host_table();
- for (index = 0; index < MSG_get_host_number() - 1; index++) {
- jhost = (jobject) hosts[index]->data;
+ hosts = MSG_hosts_as_dynar();
+ for (index = 0; index < xbt_dynar_length(hosts) - 1; index++) {
+ jhost = (jobject) xbt_dynar_get_as(hosts,index,m_host_t)->data;
- /* cleanup native stuff */
- rv = MSG_OK != MSG_clean();
+}
+JNIEXPORT void JNICALL
+ JNICALL Java_org_simgrid_msg_Msg_clean(JNIEnv * env, jclass cls)
+{
+ /* cleanup native stuff. Calling it is ... useless since leaking memory at the end of the simulation is a non-issue */
+ MSG_error_t rv = MSG_OK != MSG_clean();
jxbt_check_res("MSG_clean()", rv, MSG_OK,
bprintf
("unexpected error : MSG_clean() failed .. please report this bug "));
}
jxbt_check_res("MSG_clean()", rv, MSG_OK,
bprintf
("unexpected error : MSG_clean() failed .. please report this bug "));
}
(*env)->SetObjectArrayElement(env, jtable, index, jhost);
}
(*env)->SetObjectArrayElement(env, jtable, index, jhost);
}