< prev index next >

src/java.base/share/native/libjava/Thread.c

Print this page

 1 /*
 2  * Copyright (c) 1994, 2023, Oracle and/or its affiliates. All rights reserved.
 3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 4  *
 5  * This code is free software; you can redistribute it and/or modify it
 6  * under the terms of the GNU General Public License version 2 only, as
 7  * published by the Free Software Foundation.  Oracle designates this
 8  * particular file as subject to the "Classpath" exception as provided
 9  * by Oracle in the LICENSE file that accompanied this code.
10  *
11  * This code is distributed in the hope that it will be useful, but WITHOUT
12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
14  * version 2 for more details (a copy is included in the LICENSE file that
15  * accompanied this code).
16  *
17  * You should have received a copy of the GNU General Public License version
18  * 2 along with this work; if not, write to the Free Software Foundation,
19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20  *
21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22  * or visit www.oracle.com if you need additional information or have any

26 #include "jni.h"
27 #include "jvm.h"
28 
29 #include "java_lang_Thread.h"
30 
31 #define THD "Ljava/lang/Thread;"
32 #define OBJ "Ljava/lang/Object;"
33 #define STE "Ljava/lang/StackTraceElement;"
34 #define STR "Ljava/lang/String;"
35 
36 #define ARRAY_LENGTH(a) (sizeof(a)/sizeof(a[0]))
37 
38 static JNINativeMethod methods[] = {
39     {"start0",           "()V",        (void *)&JVM_StartThread},
40     {"setPriority0",     "(I)V",       (void *)&JVM_SetThreadPriority},
41     {"yield0",           "()V",        (void *)&JVM_Yield},
42     {"sleepNanos0",      "(J)V",       (void *)&JVM_SleepNanos},
43     {"currentCarrierThread", "()" THD, (void *)&JVM_CurrentCarrierThread},
44     {"currentThread",    "()" THD,     (void *)&JVM_CurrentThread},
45     {"setCurrentThread", "(" THD ")V", (void *)&JVM_SetCurrentThread},

46     {"interrupt0",       "()V",        (void *)&JVM_Interrupt},
47     {"holdsLock",        "(" OBJ ")Z", (void *)&JVM_HoldsLock},
48     {"getThreads",       "()[" THD,    (void *)&JVM_GetAllThreads},
49     {"dumpThreads",      "([" THD ")[[" STE, (void *)&JVM_DumpThreads},
50     {"getStackTrace0",   "()" OBJ,     (void *)&JVM_GetStackTrace},
51     {"setNativeName",    "(" STR ")V", (void *)&JVM_SetNativeThreadName},
52     {"scopedValueCache", "()[" OBJ,    (void *)&JVM_ScopedValueCache},
53     {"setScopedValueCache", "([" OBJ ")V",(void *)&JVM_SetScopedValueCache},
54     {"getNextThreadIdOffset", "()J",   (void *)&JVM_GetNextThreadIdOffset},
55     {"findScopedValueBindings", "()" OBJ, (void *)&JVM_FindScopedValueBindings},
56     {"ensureMaterializedForStackWalk",
57                          "(" OBJ ")V", (void*)&JVM_EnsureMaterializedForStackWalk_func},
58 };
59 
60 #undef THD
61 #undef OBJ
62 #undef STE
63 #undef STR
64 
65 JNIEXPORT void JNICALL

 1 /*
 2  * Copyright (c) 1994, 2024, Oracle and/or its affiliates. All rights reserved.
 3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 4  *
 5  * This code is free software; you can redistribute it and/or modify it
 6  * under the terms of the GNU General Public License version 2 only, as
 7  * published by the Free Software Foundation.  Oracle designates this
 8  * particular file as subject to the "Classpath" exception as provided
 9  * by Oracle in the LICENSE file that accompanied this code.
10  *
11  * This code is distributed in the hope that it will be useful, but WITHOUT
12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
14  * version 2 for more details (a copy is included in the LICENSE file that
15  * accompanied this code).
16  *
17  * You should have received a copy of the GNU General Public License version
18  * 2 along with this work; if not, write to the Free Software Foundation,
19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20  *
21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22  * or visit www.oracle.com if you need additional information or have any

26 #include "jni.h"
27 #include "jvm.h"
28 
29 #include "java_lang_Thread.h"
30 
31 #define THD "Ljava/lang/Thread;"
32 #define OBJ "Ljava/lang/Object;"
33 #define STE "Ljava/lang/StackTraceElement;"
34 #define STR "Ljava/lang/String;"
35 
36 #define ARRAY_LENGTH(a) (sizeof(a)/sizeof(a[0]))
37 
38 static JNINativeMethod methods[] = {
39     {"start0",           "()V",        (void *)&JVM_StartThread},
40     {"setPriority0",     "(I)V",       (void *)&JVM_SetThreadPriority},
41     {"yield0",           "()V",        (void *)&JVM_Yield},
42     {"sleepNanos0",      "(J)V",       (void *)&JVM_SleepNanos},
43     {"currentCarrierThread", "()" THD, (void *)&JVM_CurrentCarrierThread},
44     {"currentThread",    "()" THD,     (void *)&JVM_CurrentThread},
45     {"setCurrentThread", "(" THD ")V", (void *)&JVM_SetCurrentThread},
46     {"setCurrentLockId", "(J)V",       (void *)&JVM_SetCurrentLockId},
47     {"interrupt0",       "()V",        (void *)&JVM_Interrupt},
48     {"holdsLock",        "(" OBJ ")Z", (void *)&JVM_HoldsLock},
49     {"getThreads",       "()[" THD,    (void *)&JVM_GetAllThreads},
50     {"dumpThreads",      "([" THD ")[[" STE, (void *)&JVM_DumpThreads},
51     {"getStackTrace0",   "()" OBJ,     (void *)&JVM_GetStackTrace},
52     {"setNativeName",    "(" STR ")V", (void *)&JVM_SetNativeThreadName},
53     {"scopedValueCache", "()[" OBJ,    (void *)&JVM_ScopedValueCache},
54     {"setScopedValueCache", "([" OBJ ")V",(void *)&JVM_SetScopedValueCache},
55     {"getNextThreadIdOffset", "()J",   (void *)&JVM_GetNextThreadIdOffset},
56     {"findScopedValueBindings", "()" OBJ, (void *)&JVM_FindScopedValueBindings},
57     {"ensureMaterializedForStackWalk",
58                          "(" OBJ ")V", (void*)&JVM_EnsureMaterializedForStackWalk_func},
59 };
60 
61 #undef THD
62 #undef OBJ
63 #undef STE
64 #undef STR
65 
66 JNIEXPORT void JNICALL
< prev index next >