765960d92c233ae5be0d9dacbf1c96d46005a7e9
[cacao.git] / src / native / vm / gnu / java_lang_VMThread.c
1 /* src/native/vm/gnu/java_lang_VMThread.c
2
3    Copyright (C) 1996-2005, 2006, 2007 R. Grafl, A. Krall, C. Kruegel,
4    C. Oates, R. Obermaisser, M. Platter, M. Probst, S. Ring,
5    E. Steiner, C. Thalinger, D. Thuernbeck, P. Tomsich, C. Ullrich,
6    J. Wenninger, Institut f. Computersprachen - TU Wien
7
8    This file is part of CACAO.
9
10    This program is free software; you can redistribute it and/or
11    modify it under the terms of the GNU General Public License as
12    published by the Free Software Foundation; either version 2, or (at
13    your option) any later version.
14
15    This program is distributed in the hope that it will be useful, but
16    WITHOUT ANY WARRANTY; without even the implied warranty of
17    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18    General Public License for more details.
19
20    You should have received a copy of the GNU General Public License
21    along with this program; if not, write to the Free Software
22    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
23    02110-1301, USA.
24
25    $Id: java_lang_VMThread.c 7246 2007-01-29 18:49:05Z twisti $
26
27 */
28
29
30 #include "config.h"
31 #include "vm/types.h"
32
33 #include "native/jni.h"
34 #include "native/native.h"
35 #include "native/include/java_lang_ThreadGroup.h"
36 #include "native/include/java_lang_Object.h"            /* java_lang_Thread.h */
37 #include "native/include/java_lang_Throwable.h"         /* java_lang_Thread.h */
38 #include "native/include/java_lang_VMThread.h"
39 #include "native/include/java_lang_Thread.h"
40 #include "native/vm/java_lang_Thread.h"
41
42 #if defined(ENABLE_THREADS)
43 # include "threads/native/threads.h"
44 #endif
45
46
47 /*
48  * Class:     java/lang/VMThread
49  * Method:    countStackFrames
50  * Signature: ()I
51  */
52 JNIEXPORT s4 JNICALL Java_java_lang_VMThread_countStackFrames(JNIEnv *env, java_lang_VMThread *this)
53 {
54     return _Jv_java_lang_Thread_countStackFrames(this->thread);
55 }
56
57
58 /*
59  * Class:     java/lang/VMThread
60  * Method:    start
61  * Signature: (J)V
62  */
63 JNIEXPORT void JNICALL Java_java_lang_VMThread_start(JNIEnv *env, java_lang_VMThread *this, s8 stacksize)
64 {
65         _Jv_java_lang_Thread_start(this->thread, stacksize);
66 }
67
68
69 /*
70  * Class:     java/lang/VMThread
71  * Method:    interrupt
72  * Signature: ()V
73  */
74 JNIEXPORT void JNICALL Java_java_lang_VMThread_interrupt(JNIEnv *env, java_lang_VMThread *this)
75 {
76         _Jv_java_lang_Thread_interrupt(this->thread);
77 }
78
79
80 /*
81  * Class:     java/lang/VMThread
82  * Method:    isInterrupted
83  * Signature: ()Z
84  */
85 JNIEXPORT s4 JNICALL Java_java_lang_VMThread_isInterrupted(JNIEnv *env, java_lang_VMThread *this)
86 {
87         return _Jv_java_lang_Thread_isInterrupted(this->thread);
88 }
89
90
91 /*
92  * Class:     java/lang/VMThread
93  * Method:    suspend
94  * Signature: ()V
95  */
96 JNIEXPORT void JNICALL Java_java_lang_VMThread_suspend(JNIEnv *env, java_lang_VMThread *this)
97 {
98         _Jv_java_lang_Thread_suspend(this->thread);
99 }
100
101
102 /*
103  * Class:     java/lang/VMThread
104  * Method:    resume
105  * Signature: ()V
106  */
107 JNIEXPORT void JNICALL Java_java_lang_VMThread_resume(JNIEnv *env, java_lang_VMThread *this)
108 {
109         _Jv_java_lang_Thread_resume(this->thread);
110 }
111
112
113 /*
114  * Class:     java/lang/VMThread
115  * Method:    nativeSetPriority
116  * Signature: (I)V
117  */
118 JNIEXPORT void JNICALL Java_java_lang_VMThread_nativeSetPriority(JNIEnv *env, java_lang_VMThread *this, s4 priority)
119 {
120         _Jv_java_lang_Thread_setPriority(this->thread, priority);
121 }
122
123
124 /*
125  * Class:     java/lang/VMThread
126  * Method:    nativeStop
127  * Signature: (Ljava/lang/Object;)V
128  */
129 JNIEXPORT void JNICALL Java_java_lang_VMThread_nativeStop(JNIEnv *env, java_lang_VMThread *this, java_lang_Throwable *t)
130 {
131         _Jv_java_lang_Thread_stop(this->thread, t);
132 }
133
134
135 /*
136  * Class:     java/lang/VMThread
137  * Method:    currentThread
138  * Signature: ()Ljava/lang/Thread;
139  */
140 JNIEXPORT java_lang_Thread* JNICALL Java_java_lang_VMThread_currentThread(JNIEnv *env, jclass clazz)
141 {
142         return _Jv_java_lang_Thread_currentThread();
143 }
144
145
146 /*
147  * Class:     java/lang/VMThread
148  * Method:    yield
149  * Signature: ()V
150  */
151 JNIEXPORT void JNICALL Java_java_lang_VMThread_yield(JNIEnv *env, jclass clazz)
152 {
153         _Jv_java_lang_Thread_yield();
154 }
155
156
157 /*
158  * Class:     java/lang/VMThread
159  * Method:    interrupted
160  * Signature: ()Z
161  */
162 JNIEXPORT s4 JNICALL Java_java_lang_VMThread_interrupted(JNIEnv *env, jclass clazz)
163 {
164         return _Jv_java_lang_Thread_interrupted();
165 }
166
167
168 /*
169  * Class:     java/lang/VMThread
170  * Method:    holdsLock
171  * Signature: (Ljava/lang/Object;)Z
172  */
173 JNIEXPORT s4 JNICALL Java_java_lang_VMThread_holdsLock(JNIEnv *env, jclass clazz, java_lang_Object* o)
174 {
175         return _Jv_java_lang_Thread_holdsLock(o);
176 }
177
178
179 /*
180  * Class:     java/lang/VMThread
181  * Method:    getState
182  * Signature: ()Ljava/lang/String;
183  */
184 JNIEXPORT java_lang_String* JNICALL Java_java_lang_VMThread_getState(JNIEnv *env, java_lang_VMThread *this)
185 {
186         return _Jv_java_lang_Thread_getState(this->thread);
187 }
188
189
190 /*
191  * These are local overrides for various environment variables in Emacs.
192  * Please do not remove this and leave it at the end of the file, where
193  * Emacs will automagically detect them.
194  * ---------------------------------------------------------------------
195  * Local variables:
196  * mode: c
197  * indent-tabs-mode: t
198  * c-basic-offset: 4
199  * tab-width: 4
200  * End:
201  */