c415853b831af066203995908535ade7015b8941
[cacao.git] / src / native / vm / cldc1.1 / java_lang_Thread.c
1 /* src/native/vm/cldc1.1/java_lang_Thread.c
2
3    Copyright (C) 2006, 2007 R. Grafl, A. Krall, C. Kruegel, C. Oates,
4    R. Obermaisser, M. Platter, M. Probst, S. Ring, E. Steiner,
5    C. Thalinger, D. Thuernbeck, P. Tomsich, C. Ullrich, J. Wenninger,
6    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_VMRuntime.c 5900 2006-11-04 17:30:44Z michi $
26
27 */
28
29
30 #include "config.h"
31 #include "vm/types.h"
32
33 #include "native/jni.h"
34
35 #include "native/include/java_lang_Thread.h"
36
37 #include "native/vm/java_lang_Thread.h"
38
39 #if defined(ENABLE_THREADS)
40 # include "threads/native/threads.h"
41 #endif
42
43 #include "toolbox/logging.h"
44
45 #include "vm/builtin.h"
46
47
48 /*
49  * Class:     java/lang/Thread
50  * Method:    currentThread
51  * Signature: ()Ljava/lang/Thread;
52  */
53 JNIEXPORT java_lang_Thread* JNICALL Java_java_lang_Thread_currentThread(JNIEnv *env, jclass clazz)
54 {
55         return _Jv_java_lang_Thread_currentThread();
56 }
57
58
59 /*
60  * Class:     java/lang/Thread
61  * Method:    setPriority0
62  * Signature: (II)V
63  */
64 JNIEXPORT void JNICALL Java_java_lang_Thread_setPriority0(JNIEnv *env, java_lang_Thread *this, s4 oldPriority, s4 newPriority)
65 {
66         _Jv_java_lang_Thread_setPriority(this, newPriority);
67 }
68
69
70 /*
71  * Class:     java/lang/Thread
72  * Method:    sleep
73  * Signature: (J)V
74  */
75 JNIEXPORT void JNICALL Java_java_lang_Thread_sleep(JNIEnv *env, jclass clazz, s8 millis)
76 {
77         _Jv_java_lang_Thread_sleep(millis);
78 }
79
80
81 /*
82  * Class:     java/lang/Thread
83  * Method:    start0
84  * Signature: ()V
85  */
86 JNIEXPORT void JNICALL Java_java_lang_Thread_start0(JNIEnv *env, java_lang_Thread *this)
87 {
88         _Jv_java_lang_Thread_start(this, 0);
89 }
90
91
92 /*
93  * Class:     java/lang/Thread
94  * Method:    isAlive
95  * Signature: ()Z
96  */
97 JNIEXPORT s4 JNICALL Java_java_lang_Thread_isAlive(JNIEnv *env, java_lang_Thread *this)
98 {
99         return _Jv_java_lang_Thread_isAlive(this);
100 }
101
102
103 #if 0
104 /*
105  * Class:     java/lang/Thread
106  * Method:    activeCount
107  * Signature: ()I
108  */
109 JNIEXPORT s4 JNICALL Java_java_lang_Thread_activeCount(JNIEnv *env, jclass clazz)
110 {
111 }
112
113
114 /*
115  * Class:     java/lang/Thread
116  * Method:    setPriority0
117  * Signature: (II)V
118  */
119 JNIEXPORT void JNICALL Java_java_lang_Thread_setPriority0(JNIEnv *env, struct java_lang_Thread* this, s4 par1, s4 par2)
120 {
121 }
122
123
124 /*
125  * Class:     java/lang/Thread
126  * Method:    interrupt0
127  * Signature: ()V
128  */
129 JNIEXPORT void JNICALL Java_java_lang_Thread_interrupt0(JNIEnv *env, struct java_lang_Thread* this)
130 {
131 }
132
133
134 /*
135  * Class:     java/lang/Thread
136  * Method:    internalExit
137  * Signature: ()V
138  */
139 JNIEXPORT void JNICALL Java_java_lang_Thread_internalExit(JNIEnv *env, struct java_lang_Thread* this)
140 {
141 }
142 #endif
143
144
145 /*
146  * Class:     java/lang/Thread
147  * Method:    yield
148  * Signature: ()V
149  */
150 JNIEXPORT void JNICALL Java_java_lang_Thread_yield(JNIEnv *env, jclass clazz)
151 {
152 #if defined(ENABLE_THREADS)
153         threads_yield();
154 #endif
155 }
156
157
158 /*
159  * These are local overrides for various environment variables in Emacs.
160  * Please do not remove this and leave it at the end of the file, where
161  * Emacs will automagically detect them.
162  * ---------------------------------------------------------------------
163  * Local variables:
164  * mode: c
165  * indent-tabs-mode: t
166  * c-basic-offset: 4
167  * tab-width: 4
168  * End:
169  * vim:noexpandtab:sw=4:ts=4:
170  */