Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge pull request #237 from oar-team/upstream
[simgrid.git] / src / bindings / java / jmsg_process.h
1 /* Functions related to the java process instances.                         */
2
3 /* Copyright (c) 2007-2017. The SimGrid Team. All rights reserved.          */
4
5 /* This program is free software; you can redistribute it and/or modify it
6  * under the terms of the license (GNU LGPL) which comes with this package. */
7
8 #ifndef MSG_JPROCESS_H
9 #define MSG_JPROCESS_H
10
11 #include "simgrid/msg.h"
12 #include <jni.h>
13
14 SG_BEGIN_DECL();
15
16 /* Shut up some errors in eclipse online compiler. I wish such a pimple wouldn't be needed */
17 #ifndef JNIEXPORT
18 #define JNIEXPORT
19 #endif
20 #ifndef JNICALL
21 #define JNICALL
22 #endif
23 /* end of eclipse-mandated pimple */
24
25 // Cached java fields accessed by the rest of the code (FIXME: they should not)
26 extern jfieldID jprocess_field_Process_pid;
27 extern jfieldID jprocess_field_Process_ppid;
28
29 /** Take a ref onto the java instance (to prevent its collection) */
30 jobject jprocess_ref(jobject jprocess, JNIEnv* env);
31
32 /** Release a ref onto the java instance */
33 void jprocess_unref(jobject jprocess, JNIEnv* env);
34
35 /** Binds a native instance to a java instance. */
36 void jprocess_bind(jobject jprocess, msg_process_t process, JNIEnv* env);
37
38 /** Extract the java instance from the native one */
39 jobject jprocess_from_native(msg_process_t process);
40
41 /** Extract the native instance from the java one */
42 msg_process_t jprocess_to_native(jobject jprocess, JNIEnv* env);
43
44 /** Initialize the native world, called from the Java world at startup */
45 JNIEXPORT void JNICALL Java_org_simgrid_msg_Process_nativeInit(JNIEnv *env, jclass cls);
46
47 /* Implement the Java API */
48
49 JNIEXPORT void JNICALL Java_org_simgrid_msg_Process_create(JNIEnv* env, jobject jprocess_arg, jobject jhostname);
50 JNIEXPORT jint JNICALL Java_org_simgrid_msg_Process_killAll(JNIEnv* env, jclass cls, jint jresetPID);
51 JNIEXPORT jobject JNICALL Java_org_simgrid_msg_Process_fromPID(JNIEnv* env, jclass cls, jint pid);
52 JNIEXPORT jobject JNICALL Java_org_simgrid_msg_Process_getProperty(JNIEnv* env, jobject jprocess, jobject jname);
53 JNIEXPORT jobject JNICALL Java_org_simgrid_msg_Process_getCurrentProcess(JNIEnv* env, jclass cls);
54 JNIEXPORT void JNICALL Java_org_simgrid_msg_Process_suspend(JNIEnv* env, jobject jprocess);
55 JNIEXPORT void JNICALL Java_org_simgrid_msg_Process_resume(JNIEnv* env, jobject jprocess);
56 JNIEXPORT void JNICALL Java_org_simgrid_msg_Process_setAutoRestart(JNIEnv* env, jobject jprocess, jboolean jauto_restart);
57 JNIEXPORT void JNICALL Java_org_simgrid_msg_Process_restart(JNIEnv* env, jobject jprocess);
58 JNIEXPORT jboolean JNICALL Java_org_simgrid_msg_Process_isSuspended(JNIEnv* env, jobject jprocess);
59 JNIEXPORT void JNICALL Java_org_simgrid_msg_Process_sleep(JNIEnv* env, jclass cls, jlong jmillis, jint jnanos);
60 JNIEXPORT void JNICALL Java_org_simgrid_msg_Process_waitFor(JNIEnv* env, jobject jprocess, jdouble jseconds);
61 JNIEXPORT void JNICALL Java_org_simgrid_msg_Process_kill(JNIEnv* env, jobject jprocess);
62 JNIEXPORT void JNICALL Java_org_simgrid_msg_Process_migrate(JNIEnv* env, jobject jprocess, jobject jhost);
63 JNIEXPORT void JNICALL Java_org_simgrid_msg_Process_yield(JNIEnv* env, jclass cls);
64 JNIEXPORT void JNICALL Java_org_simgrid_msg_Process_setKillTime(JNIEnv* env, jobject jprocess, jdouble jkilltime);
65 JNIEXPORT jint JNICALL Java_org_simgrid_msg_Process_getCount(JNIEnv * env, jclass cls);
66
67 SG_END_DECL();
68 #endif