Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
fix: correct trace mask checking
[simgrid.git] / src / java / jmsg_process.h
1 /*
2  * $Id$
3  *
4  * Copyright 2006,2007 Martin Quinson, Malek Cherier All right reserved. 
5  *
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.
8  *
9  * This contains the declarations of the functions in relation with the java
10  * process instance.
11  */
12
13 #ifndef MSG_JPROCESS_H
14 #define MSG_JPROCESS_H
15
16 #include <jni.h>
17 #include "msg/msg.h"
18 #include "simix/simix.h"
19
20 /**
21  * This function returns a global reference to the  java process instance 
22  * specified by the parameter jprocess.
23  *
24  * @param jprocess              The original java process instance.
25  * @param env                   The env of the current thread
26  *
27  * @return                              The global reference to the original java process 
28  *                                              instance.
29  */
30 jobject jprocess_new_global_ref(jobject jprocess, JNIEnv * env);
31
32 /**
33  * This function delete a global reference to a java process instance.
34  * If the java process is alive the function joins it and stops it before.
35  *
36  * @param                               The global refernce to delete.
37  * @param env                   The env of the current thread
38  *
39  * @see                                 jprocess_join()
40  * @see                                 jprocess_exit()
41  */
42 void jprocess_delete_global_ref(jobject jprocess, JNIEnv * env);
43
44 /**
45  *
46  * This function tests if the specified java process instance is alive. 
47  * A java process object is alive if it has been started and has not yet 
48  * terminated.
49  * 
50  * @param jprocess              The java process to test.
51  * @param env                   The env of the current thread
52  *
53  * @exception                   If the class Process is not found the function throws 
54  *                                              the ClassNotFoundException. If the methos isAlive() of 
55  *                                              this class is not found the function throws the exception 
56  *                                              NotSuchMethodException. 
57  *
58  * @return                              If the java process is alive the function returns
59  *                                              true. Otherwise the function returns false.
60  */
61 jboolean jprocess_is_alive(jobject jprocess, JNIEnv * env);
62
63 /**
64  * This function waits for a java process to terminate.
65  *
66  * @param jprocess              The java process ot wait for.
67  * @param env                   The env of the current thread
68  *
69  * @exception                   If the class Process is not found the function throws 
70  *                                              the ClassNotFoundException. If the methos join() of 
71  *                                              this class is not found the function throws the exception 
72  *                                              NotSuchMethodException. 
73  *
74  */
75 void jprocess_join(jobject jprocess, JNIEnv * env);
76
77 /**
78  * This function starts the specified java process.
79  *
80  * @param jprocess              The java process to start.
81  * @param env                   The env of the current thread
82  *
83  * @exception                   If the class Process is not found the function throws 
84  *                                              the ClassNotFoundException. If the methos start() of 
85  *                                              this class is not found the function throws the exception 
86  *                                              NotSuchMethodException. 
87  */
88 void jprocess_start(jobject jprocess, JNIEnv * env);
89
90 /**
91  * This function forces the java process to stop.
92  *
93  * @param jprocess              The java process to stop.
94  * @param env                   The env of the current thread
95  *
96  * @exception                   If the class Process is not found the function throws 
97  *                                              the ClassNotFoundException. If the methos stop() of 
98  *                                              this class is not found the function throws the exception 
99  *                                              NotSuchMethodException. 
100  */
101 void jprocess_exit(jobject jprocess, JNIEnv * env);
102
103 /**
104  * This function associated a native process to a java process instance.
105  *
106  * @param jprocess              The java process instance.
107  * @param process               The native process to bind.
108  * @param env                   The env of the current thread
109  *
110  * @exception                   If the class Process is not found the function throws 
111  *                                              the ClassNotFoundException. If the field bind of 
112  *                                              this class is not found the function throws the exception 
113  *                                              NotSuchFieldException.  
114  */
115 void jprocess_bind(jobject jprocess, m_process_t process, JNIEnv * env);
116
117 /**
118  * This function returns a native process from a java process instance.
119  *
120  * @param jprocess              The java process object from which get the native process.
121  * @param env                   The env of the current thread
122  *
123  * @return                              The function returns the native process associated to the
124  *                                              java process object.
125  *
126  * @exception                   If the class Process is not found the function throws 
127  *                                              the ClassNotFoundException. If the field bind of 
128  *                                              this class is not found the function throws the exception 
129  *                                              NotSuchFieldException.  
130  */
131 m_process_t jprocess_to_native_process(jobject jprocess, JNIEnv * env);
132
133 /**
134  * This function gets the id of the specified java process.
135  *
136  * @param jprocess              The java process to get the id.
137  * @param env                   The env of the current thread
138  *
139  * @exception                   If the class Process is not found the function throws 
140  *                                              the ClassNotFoundException. If the field id of 
141  *                                              this class is not found the function throws the exception 
142  *                                              NotSuchFieldException.  
143  *
144  * @return                              The id of the specified java process.
145  */
146 jlong jprocess_get_id(jobject jprocess, JNIEnv * env);
147
148 /**
149  * This function tests if a java process instance is valid.
150  * A java process object is valid if it is bind to a native 
151  * process.
152  *
153  * @param jprocess              The java process to test the validity.
154  * @param env                   The env of the current thread
155  *
156  * @return                              If the java process is valid the function returns true.
157  *                                              Otherwise the function returns false.
158  */
159 jboolean jprocess_is_valid(jobject jprocess, JNIEnv * env);
160
161 /**
162  * This function gets the name of the specified java process.
163  *
164  * @param jprocess              The java process to get the name.
165  * @param env                   The env of the current thread
166  *
167  * @exception                   If the class Process is not found the function throws 
168  *                                              the ClassNotFoundException. If the field name of 
169  *                                              this class is not found the function throws the exception 
170  *                                              NotSuchFieldException.  
171  *
172  * @return                              The name of the specified java process.
173  */
174 jstring jprocess_get_name(jobject jprocess, JNIEnv * env);
175
176 /**
177  * This function yields the specified java process.
178  *
179  * @param jprocess              The java process to yield.
180  * @param env                   The env of the current thread.
181  *
182  * @exception                   If the class Process is not found the function throws 
183  *                                              the ClassNotFoundException. If the method switchProcess of 
184  *                                              this class is not found the function throws the exception 
185  *                                              NotSuchMethodException.
186  */
187 void jprocess_yield(jobject jprocess, JNIEnv * env);
188
189 /**
190  * This function locks the mutex of the specified java process.
191  *
192  * @param jprocess              The java process of the mutex to lock.
193  * @param env                   The env of the current thread.
194  *
195  * @exception                   If the class Process is not found the function throws 
196  *                                              the ClassNotFoundException. If the method lockMutex of 
197  *                                              this class is not found the function throws the exception 
198  *                                              NotSuchMethodException.
199  */
200 void jprocess_lock_mutex(jobject jprocess, JNIEnv * env);
201
202 /**
203  * This function unlocks the mutex of the specified java process.
204  *
205  * @param jprocess              The java process of the mutex to unlock.
206  * @param env                   The env of the current thread.
207  *
208  * @exception                   If the class Process is not found the function throws 
209  *                                              the ClassNotFoundException. If the method unlockMutex of 
210  *                                              this class is not found the function throws the exception 
211  *                                              NotSuchMethodException.
212  */
213 void jprocess_unlock_mutex(jobject jprocess, JNIEnv * env);
214
215 /**
216  * This function signals the condition of the mutex of the specified java process.
217  *
218  * @param jprocess              The java process of the condtion to signal.
219  * @param env                   The env of the current thread.
220  *
221  * @exception                   If the class Process is not found the function throws 
222  *                                              the ClassNotFoundException. If the method signalCond of 
223  *                                              this class is not found the function throws the exception 
224  *                                              NotSuchMethodException.
225  */
226 void jprocess_signal_cond(jobject jprocess, JNIEnv * env);
227
228 /**
229  * This function waits the condition of the mutex of the specified java process.
230  *
231  * @param jprocess              The java process of the condtion to wait for.
232  * @param env                   The env of the current thread.
233  *
234  * @exception                   If the class Process is not found the function throws 
235  *                                              the ClassNotFoundException. If the method waitCond of 
236  *                                              this class is not found the function throws the exception 
237  *                                              NotSuchMethodException.
238  */
239 void jprocess_wait_cond(jobject jprocess, JNIEnv * env);
240
241 void jprocess_schedule(smx_context_t context);
242
243 void jprocess_unschedule(smx_context_t context);
244
245
246 #endif /* !MSG_JPROCESS_H */