Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
The JNI interface for the Java ApplicationHandler
[simgrid.git] / src / java / jmsg_process.c
index f4abf58..2fb7ecf 100644 (file)
  * process instance. 
  */
  
-#include "jmsg.h"
 #include "jmsg_process.h"
+#include "jmsg.h"
 #include "jxbt_utilities.h"
 
-XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(jmsg);
+#include "xbt/xbt_context_java.h"
 
+XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(jmsg);
 
 jobject
 jprocess_new_global_ref(jobject jprocess,JNIEnv* env) {
@@ -112,7 +113,7 @@ jprocess_wait_cond(jobject jprocess,JNIEnv* env) {
 void
 jprocess_start(jobject jprocess,JNIEnv* env) {
   jmethodID id = jxbt_get_smethod(env,"simgrid/msg/Process","start", "()V");
-    
+
   if(!id)
     return;
 
@@ -174,3 +175,37 @@ jprocess_is_valid(jobject jprocess,JNIEnv* env) {
 
   return (*env)->GetLongField(env,jprocess,id) ? JNI_TRUE : JNI_FALSE; 
 }
+
+void
+jprocess_schedule(xbt_context_t context) {
+       JNIEnv * env;
+       jmethodID id;
+       
+       env = get_current_thread_env();
+
+       id = jxbt_get_smethod(env,"simgrid/msg/Process","schedule", "()V");
+       
+       if(!id)
+               return;
+       
+       (*env)->CallVoidMethod(env,((xbt_ctx_java_t)context)->jprocess,id);
+}
+
+
+
+void
+jprocess_unschedule(xbt_context_t context) {
+       JNIEnv * env;
+       jmethodID id;
+
+       env = get_current_thread_env();
+
+       
+       id = jxbt_get_smethod(env,"simgrid/msg/Process","unschedule", "()V");
+       
+       if(!id)
+               return;
+       
+       (*env)->CallVoidMethod(env,((xbt_ctx_java_t)context)->jprocess,id);
+}
+