4 * Copyright 2006,2007 Martin Quinson, Malek Cherier All right reserved.
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the license (GNU LGPL) which comes with this package.
9 * This contains the implementation of the functions in relation with the java
14 #include "jmsg_task.h"
15 #include "jxbt_utilities.h"
17 jobject jtask_new_global_ref(jobject jtask, JNIEnv * env)
19 return (*env)->NewGlobalRef(env, jtask);
22 void jtask_delete_global_ref(jobject jtask, JNIEnv * env)
24 (*env)->DeleteGlobalRef(env, jtask);
27 void jtask_bind(jobject jtask, m_task_t task, JNIEnv * env)
29 jfieldID id = jxbt_get_sfield(env, "simgrid/msg/Task", "bind", "J");
34 (*env)->SetLongField(env, jtask, id, (jlong) (long) (task));
37 m_task_t jtask_to_native_task(jobject jtask, JNIEnv * env)
39 jfieldID id = jxbt_get_sfield(env, "simgrid/msg/Task", "bind", "J");
44 return (m_task_t) (long) (*env)->GetLongField(env, jtask, id);
47 jboolean jtask_is_valid(jobject jtask, JNIEnv * env)
49 jfieldID id = jxbt_get_sfield(env, "simgrid/msg/Task", "bind", "J");
54 return (*env)->GetLongField(env, jtask, id) ? JNI_TRUE : JNI_FALSE;