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
25 $Id: java_lang_VMRuntime.c 5900 2006-11-04 17:30:44Z michi $
33 #include "native/jni.h"
34 #include "native/native.h"
36 #include "native/include/java_lang_Thread.h"
38 #include "native/vm/java_lang_Thread.h"
40 #include "threads/threads-common.h"
42 #include "toolbox/logging.h"
44 #include "vm/builtin.h"
47 /* native methods implemented by this file ************************************/
49 static JNINativeMethod methods[] = {
50 { "currentThread", "()Ljava/lang/Thread;", (void *) (ptrint) &Java_java_lang_Thread_currentThread },
51 { "setPriority0", "(II)V", (void *) (ptrint) &Java_java_lang_Thread_setPriority0 },
52 { "sleep", "(J)V", (void *) (ptrint) &Java_java_lang_Thread_sleep },
53 { "start0", "()V", (void *) (ptrint) &Java_java_lang_Thread_start0 },
54 { "isAlive", "()Z", (void *) (ptrint) &Java_java_lang_Thread_isAlive },
56 { "activeCount", "()I", (void *) (ptrint) &Java_java_lang_Thread_activeCount },
57 { "setPriority0", "(II)V", (void *) (ptrint) &Java_java_lang_Thread_setPriority0 },
58 { "interrupt0", "()V", (void *) (ptrint) &Java_java_lang_Thread_interrupt0 },
59 { "internalExit", "()V", (void *) (ptrint) &Java_java_lang_Thread_internalExit },
61 { "yield", "()V", (void *) (ptrint) &Java_java_lang_Thread_yield },
65 /* _Jv_java_lang_Thread_init ***************************************************
67 Register native functions.
69 *******************************************************************************/
71 void _Jv_java_lang_Thread_init(void)
75 u = utf_new_char("java/lang/Thread");
77 native_method_register(u, methods, NATIVE_METHODS_COUNT);
82 * Class: java/lang/Thread
83 * Method: currentThread
84 * Signature: ()Ljava/lang/Thread;
86 JNIEXPORT java_lang_Thread* JNICALL Java_java_lang_Thread_currentThread(JNIEnv *env, jclass clazz)
88 return _Jv_java_lang_Thread_currentThread();
93 * Class: java/lang/Thread
94 * Method: setPriority0
97 JNIEXPORT void JNICALL Java_java_lang_Thread_setPriority0(JNIEnv *env, java_lang_Thread *this, s4 oldPriority, s4 newPriority)
99 _Jv_java_lang_Thread_setPriority(this, newPriority);
104 * Class: java/lang/Thread
108 JNIEXPORT void JNICALL Java_java_lang_Thread_sleep(JNIEnv *env, jclass clazz, s8 millis)
110 _Jv_java_lang_Thread_sleep(millis);
115 * Class: java/lang/Thread
119 JNIEXPORT void JNICALL Java_java_lang_Thread_start0(JNIEnv *env, java_lang_Thread *this)
121 _Jv_java_lang_Thread_start(this, 0);
126 * Class: java/lang/Thread
130 JNIEXPORT s4 JNICALL Java_java_lang_Thread_isAlive(JNIEnv *env, java_lang_Thread *this)
132 return _Jv_java_lang_Thread_isAlive(this);
138 * Class: java/lang/Thread
139 * Method: activeCount
142 JNIEXPORT s4 JNICALL Java_java_lang_Thread_activeCount(JNIEnv *env, jclass clazz)
148 * Class: java/lang/Thread
149 * Method: setPriority0
152 JNIEXPORT void JNICALL Java_java_lang_Thread_setPriority0(JNIEnv *env, struct java_lang_Thread* this, s4 par1, s4 par2)
158 * Class: java/lang/Thread
162 JNIEXPORT void JNICALL Java_java_lang_Thread_interrupt0(JNIEnv *env, struct java_lang_Thread* this)
168 * Class: java/lang/Thread
169 * Method: internalExit
172 JNIEXPORT void JNICALL Java_java_lang_Thread_internalExit(JNIEnv *env, struct java_lang_Thread* this)
179 * Class: java/lang/Thread
183 JNIEXPORT void JNICALL Java_java_lang_Thread_yield(JNIEnv *env, jclass clazz)
185 #if defined(ENABLE_THREADS)
192 * These are local overrides for various environment variables in Emacs.
193 * Please do not remove this and leave it at the end of the file, where
194 * Emacs will automagically detect them.
195 * ---------------------------------------------------------------------
198 * indent-tabs-mode: t
202 * vim:noexpandtab:sw=4:ts=4: