0N/A/*
2362N/A * Copyright (c) 1994, 2003, Oracle and/or its affiliates. All rights reserved.
0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0N/A *
0N/A * This code is free software; you can redistribute it and/or modify it
0N/A * under the terms of the GNU General Public License version 2 only, as
2362N/A * published by the Free Software Foundation. Oracle designates this
0N/A * particular file as subject to the "Classpath" exception as provided
2362N/A * by Oracle in the LICENSE file that accompanied this code.
0N/A *
0N/A * This code is distributed in the hope that it will be useful, but WITHOUT
0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0N/A * version 2 for more details (a copy is included in the LICENSE file that
0N/A * accompanied this code).
0N/A *
0N/A * You should have received a copy of the GNU General Public License version
0N/A * 2 along with this work; if not, write to the Free Software Foundation,
0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0N/A *
2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2362N/A * or visit www.oracle.com if you need additional information or have any
2362N/A * questions.
0N/A */
0N/A
0N/A/*-
0N/A * Stuff for dealing with threads.
0N/A * originally in threadruntime.c, Sun Sep 22 12:09:39 1991
0N/A */
0N/A
0N/A#include "jni.h"
0N/A#include "jvm.h"
0N/A
0N/A#include "java_lang_Thread.h"
0N/A
0N/A#define THD "Ljava/lang/Thread;"
0N/A#define OBJ "Ljava/lang/Object;"
0N/A#define STE "Ljava/lang/StackTraceElement;"
4632N/A#define STR "Ljava/lang/String;"
0N/A
0N/A#define ARRAY_LENGTH(a) (sizeof(a)/sizeof(a[0]))
0N/A
0N/Astatic JNINativeMethod methods[] = {
0N/A {"start0", "()V", (void *)&JVM_StartThread},
0N/A {"stop0", "(" OBJ ")V", (void *)&JVM_StopThread},
0N/A {"isAlive", "()Z", (void *)&JVM_IsThreadAlive},
0N/A {"suspend0", "()V", (void *)&JVM_SuspendThread},
0N/A {"resume0", "()V", (void *)&JVM_ResumeThread},
0N/A {"setPriority0", "(I)V", (void *)&JVM_SetThreadPriority},
0N/A {"yield", "()V", (void *)&JVM_Yield},
0N/A {"sleep", "(J)V", (void *)&JVM_Sleep},
0N/A {"currentThread", "()" THD, (void *)&JVM_CurrentThread},
0N/A {"countStackFrames", "()I", (void *)&JVM_CountStackFrames},
0N/A {"interrupt0", "()V", (void *)&JVM_Interrupt},
0N/A {"isInterrupted", "(Z)Z", (void *)&JVM_IsInterrupted},
0N/A {"holdsLock", "(" OBJ ")Z", (void *)&JVM_HoldsLock},
0N/A {"getThreads", "()[" THD, (void *)&JVM_GetAllThreads},
0N/A {"dumpThreads", "([" THD ")[[" STE, (void *)&JVM_DumpThreads},
4632N/A {"setNativeName", "(" STR ")V", (void *)&JVM_SetNativeThreadName},
0N/A};
0N/A
0N/A#undef THD
0N/A#undef OBJ
0N/A#undef STE
4632N/A#undef STR
0N/A
0N/AJNIEXPORT void JNICALL
0N/AJava_java_lang_Thread_registerNatives(JNIEnv *env, jclass cls)
0N/A{
0N/A (*env)->RegisterNatives(env, cls, methods, ARRAY_LENGTH(methods));
0N/A}