1 /* src/native/vm/cldc1.1/java_lang_Thread.c
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
8 This file is part of CACAO.
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.
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.
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
31 #include "native/jni.h"
32 #include "native/native.h"
34 #include "native/include/java_lang_Thread.h"
36 #include "native/vm/java_lang_Thread.h"
38 #include "threads/threads-common.h"
40 #include "toolbox/logging.h"
42 #include "vm/builtin.h"
45 /* native methods implemented by this file ************************************/
47 static JNINativeMethod methods[] = {
48 { "currentThread", "()Ljava/lang/Thread;", (void *) (ptrint) &Java_java_lang_Thread_currentThread },
49 { "setPriority0", "(II)V", (void *) (ptrint) &Java_java_lang_Thread_setPriority0 },
50 { "sleep", "(J)V", (void *) (ptrint) &Java_java_lang_Thread_sleep },
51 { "start0", "()V", (void *) (ptrint) &Java_java_lang_Thread_start0 },
52 { "isAlive", "()Z", (void *) (ptrint) &Java_java_lang_Thread_isAlive },
54 { "activeCount", "()I", (void *) (ptrint) &Java_java_lang_Thread_activeCount },
55 { "setPriority0", "(II)V", (void *) (ptrint) &Java_java_lang_Thread_setPriority0 },
56 { "interrupt0", "()V", (void *) (ptrint) &Java_java_lang_Thread_interrupt0 },
57 { "internalExit", "()V", (void *) (ptrint) &Java_java_lang_Thread_internalExit },
59 { "yield", "()V", (void *) (ptrint) &Java_java_lang_Thread_yield },
63 /* _Jv_java_lang_Thread_init ***************************************************
65 Register native functions.
67 *******************************************************************************/
69 void _Jv_java_lang_Thread_init(void)
73 u = utf_new_char("java/lang/Thread");
75 native_method_register(u, methods, NATIVE_METHODS_COUNT);
80 * Class: java/lang/Thread
81 * Method: currentThread
82 * Signature: ()Ljava/lang/Thread;
84 JNIEXPORT java_lang_Thread* JNICALL Java_java_lang_Thread_currentThread(JNIEnv *env, jclass clazz)
86 return _Jv_java_lang_Thread_currentThread();
91 * Class: java/lang/Thread
92 * Method: setPriority0
95 JNIEXPORT void JNICALL Java_java_lang_Thread_setPriority0(JNIEnv *env, java_lang_Thread *this, s4 oldPriority, s4 newPriority)
97 _Jv_java_lang_Thread_setPriority(this, newPriority);
102 * Class: java/lang/Thread
106 JNIEXPORT void JNICALL Java_java_lang_Thread_sleep(JNIEnv *env, jclass clazz, s8 millis)
108 _Jv_java_lang_Thread_sleep(millis);
113 * Class: java/lang/Thread
117 JNIEXPORT void JNICALL Java_java_lang_Thread_start0(JNIEnv *env, java_lang_Thread *this)
119 _Jv_java_lang_Thread_start(this, 0);
124 * Class: java/lang/Thread
128 JNIEXPORT s4 JNICALL Java_java_lang_Thread_isAlive(JNIEnv *env, java_lang_Thread *this)
130 return _Jv_java_lang_Thread_isAlive(this);
136 * Class: java/lang/Thread
137 * Method: activeCount
140 JNIEXPORT s4 JNICALL Java_java_lang_Thread_activeCount(JNIEnv *env, jclass clazz)
146 * Class: java/lang/Thread
147 * Method: setPriority0
150 JNIEXPORT void JNICALL Java_java_lang_Thread_setPriority0(JNIEnv *env, struct java_lang_Thread* this, s4 par1, s4 par2)
156 * Class: java/lang/Thread
160 JNIEXPORT void JNICALL Java_java_lang_Thread_interrupt0(JNIEnv *env, struct java_lang_Thread* this)
166 * Class: java/lang/Thread
167 * Method: internalExit
170 JNIEXPORT void JNICALL Java_java_lang_Thread_internalExit(JNIEnv *env, struct java_lang_Thread* this)
177 * Class: java/lang/Thread
181 JNIEXPORT void JNICALL Java_java_lang_Thread_yield(JNIEnv *env, jclass clazz)
183 #if defined(ENABLE_THREADS)
190 * These are local overrides for various environment variables in Emacs.
191 * Please do not remove this and leave it at the end of the file, where
192 * Emacs will automagically detect them.
193 * ---------------------------------------------------------------------
196 * indent-tabs-mode: t
200 * vim:noexpandtab:sw=4:ts=4: