Main Page | Namespace List | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals | Related Pages

jlThread.h File Reference


Detailed Description

Public interface to native implementation of java.lang.Thread.

Two parallel sets of definitions are used here, one for internal implementation purposes, the other for the JNI interface. The first uses internal data types (via #ifdef JLTHREAD_LOCAL_DEFINED) where the second does not. Instead, it uses <jni.h> data types. Those types must match up for JNI to work, yet by keeping them absolutely separate, application JNI code does not have any dependencies on the core code of this JVM implementation.

Even though there is only apparently one set of definitions, the #ifdef statement controls which set is used.

This file must be included by JNI code along with the java.lang.Class JNI header file. The following example shows how to call one of the local native methods of this class from the JNI environment. Notice that although this is not necessary due to the local implementation shortcut defined in native.c, it is not only possible, but sometimes quite desirable to do so.

   #include <jni.h>
   #include <solaris/jni_md.h>    ... or appropriate platform-specifics
  
   #include "java_lang_Thread.h"  ... JNI definitions
   #include "jlThread.h"          ... this file
  
   JNIEXPORT jboolean JNICALL
       Java_java_lang_Thread_holdsLock(JNIEnv *env,
                                       jclass  thisclass,
                                       jobject thisobj)
   {
       jboolean b;

       b = jlThread_holdsLock(thisclass,
                              thisobj); ... call native implementation

       return(b);
   }
   

Attention:
This local native method implementation is defined in native.c and does not make use of the JNIENV pointer in any manner.

Although jvalue is indeed a part of both this implementation and the standard JNI interface through <jni.h> , it is not recommended to use it if at all possible. Due to the fact that both definitions involve unions, along with the slightly differing contents between the two versions, it is almost certain that there will be compilation compatibility problems in the memory layouts from one platform to another, and possibly between the layouts between them on any given platform. Since jvalue is not specificaly a Java type, but instead a JNI construction, this may not be a problem, but this advisory is raised anyway in order to encourage reliable implementation of JNI.

Control

$URL: https://svn.apache.org/path/name/jlThread.h $ $Id: jlThread.h 0 09/28/2005 dlydick $

Copyright 2005 The Apache Software Foundation or its licensors, as applicable.

Licensed under the Apache License, Version 2.0 ("the License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

See the License for the specific language governing permissions and limitations under the License.

Version:
$LastChangedRevision: 0 $
Date:
$LastChangedDate: 09/28/2005 $
Author:
$LastChangedBy: dlydick $ Original code contributed by Daniel Lydick on 09/28/2005.

Reference

Definition in file jlThread.h.

#include "jlObject.h"

Go to the source code of this file.

Connection to local native method tables.

These manifest constant code fragments are designed to be inserted directly into locations in native.c without any other modification to that file except a single entry to actually invoke the method.

#define NATIVE_TABLE_JLTHREAD
 Complete list of local native method ordinals for java.lang.Thread.
#define NATIVE_TABLE_JLTHREAD_JDOUBLE
 No (jdouble) methods.
#define NATIVE_TABLE_JLTHREAD_JFLOAT
 No (jfloat) methods.
#define NATIVE_TABLE_JLTHREAD_JINT
 (jint) local native method ordinal table for java.lang.Thread
#define NATIVE_TABLE_JLTHREAD_JLONG
 No (jlong) methods.
#define NATIVE_TABLE_JLTHREAD_JOBJECT   case JLTHREAD_NMO_CURRENTTHREAD:
 (jobject) local native method ordinal table for java.lang.Thread
#define NATIVE_TABLE_JLTHREAD_JVOID
 (jvoid) local native method ordinal table for java.lang.Thread
#define NATIVE_TABLE_JLTHREAD_ORDINALS
 Table of local native methods and their descriptors for java.lang.Thread.

Unified set of prototypes for functions

JNI table index and external reference to each function that locally implements a JNI native method.

in jlThread.c

The JVM native interface ordinal definition base for this class is 40. An enumeration is used so the compiler can help the use to not choose duplicate values.

enum  jlThread_nmo_enum {
  JLTHREAD_NMO_CURRENTTHREAD = 40, JLTHREAD_NMO_YIELD = 41, JLTHREAD_NMO_INTERRUPT = 42, JLTHREAD_NMO_INTERRUPTED = 43,
  JLTHREAD_NMO_ISINTERRUPTED = 44, JLTHREAD_NMO_SLEEP = 45, JLTHREAD_NMO_SLEEP_NANOS = 46, JLTHREAD_NMO_JOIN4EVER = 47,
  JLTHREAD_NMO_JOINTIMED = 48, JLTHREAD_NMO_JOINTIMED_NANOS = 49, JLTHREAD_NMO_ISALIVE = 50, JLTHREAD_NMO_START = 51,
  JLTHREAD_NMO_COUNTSTACKFRAMES = 52, JLTHREAD_NMO_HOLDSLOCK = 53, JLTHREAD_NMO_SETPRIORITY = 54, JLTHREAD_NMO_GETPRIORITY = 55,
  JLTHREAD_NMO_DESTROY = 56, JLTHREAD_NMO_CHECKACCESS = 57, JLTHREAD_NMO_SETDAEMON = 58, JLTHREAD_NMO_ISDAEMON = 59,
  JLTHREAD_NMO_STOP = 60, JLTHREAD_NMO_SUSPEND = 61, JLTHREAD_NMO_RESUME = 62
}
jboolean jlThread_checkAccess (jvm_object_hash objhashthis)
 JNI hook to checkAccess().
jint jlThread_countStackFrames (jvm_object_hash objhashthis)
 JNI hook to countStackFrames().
jvm_object_hash jlThread_currentThread (jvm_class_index clsidxTHR)
 JNI hook to currentThread().
jboolean jlThread_destroy (jvm_object_hash objhashthis)
 JNI hook to destroy().
jint jlThread_getPriority (jvm_object_hash objhashthis)
 JNI hook to getPriority().
jboolean jlThread_holdsLock (jvm_class_index clsidxTHR, jvm_object_hash objhashLOCK)
 JNI hook to holdsLock().
jvoid jlThread_interrupt (jvm_object_hash objhashthis)
 JNI hook to interrupt().
jboolean jlThread_interrupted (jvm_object_hash objhashTHR)
 JNI hook to interrupted().
jboolean jlThread_isAlive (jvm_object_hash objhashthis)
 JNI hook to jointimed().
jboolean jlThread_isDaemon (jvm_object_hash objhashthis)
 JNI hook to isDaemon().
jboolean jlThread_isInterrupted (jvm_object_hash objhashthis)
 JNI hook to isInterrupted().
jvoid jlThread_join4ever (jvm_object_hash objhashthis)
 JNI hook to join4ever().
jvoid jlThread_jointimed (jvm_object_hash objhashthis, jlong sleeptime)
 JNI hook to jointimed().
jvoid jlThread_jointimed_nanos (jvm_object_hash objhashthis, jlong sleeptime, jint sleeptime_nanos)
 JNI hook to jointimed_nanos().
jvoid jlThread_resume (jvm_object_hash objhashthis)
 JNI hook to resume().
jvoid jlThread_setDaemon (jvm_object_hash objhashthis, jboolean isdaemon)
 JNI hook to setDaemon().
jboolean jlThread_setPriority (jvm_object_hash objhashthis, jint priority)
 JNI hook to setPriority().
jboolean jlThread_sleep (jvm_class_index clsidxTHR, jlong sleeptime_milliseconds)
 JNI hook to sleep().
jboolean jlThread_sleep_nanos (jvm_class_index clsidxTHR, jlong sleeptime_milliseconds, jint sleeptime_nanoseconds)
 JNI hook to sleep_nanos().
jboolean jlThread_start (jvm_object_hash objhashthis)
 JNI hook to start().
jvoid jlThread_stop (jvm_object_hash objhashthis)
 JNI hook to stop().
jvoid jlThread_suspend (jvm_object_hash objhashthis)
 JNI hook to suspend().
jvoid jlThread_yield (jvm_class_index clsidxTHR)
 JNI hook to yield().


Define Documentation

#define NATIVE_TABLE_JLTHREAD
 

Value:

Complete list of local native method ordinals for java.lang.Thread.

Definition at line 366 of file jlThread.h.

Referenced by native_verify_ordinal_definition().

#define NATIVE_TABLE_JLTHREAD_ORDINALS
 

Table of local native methods and their descriptors for java.lang.Thread.

Definition at line 393 of file jlThread.h.

#define NATIVE_TABLE_JLTHREAD_JVOID
 

Value:

(jvoid) local native method ordinal table for java.lang.Thread

Definition at line 436 of file jlThread.h.

#define NATIVE_TABLE_JLTHREAD_JOBJECT   case JLTHREAD_NMO_CURRENTTHREAD:
 

(jobject) local native method ordinal table for java.lang.Thread

Definition at line 457 of file jlThread.h.

#define NATIVE_TABLE_JLTHREAD_JINT
 

Value:

(jint) local native method ordinal table for java.lang.Thread

Definition at line 464 of file jlThread.h.

#define NATIVE_TABLE_JLTHREAD_JFLOAT
 

No (jfloat) methods.

Definition at line 473 of file jlThread.h.

#define NATIVE_TABLE_JLTHREAD_JLONG
 

No (jlong) methods.

Definition at line 474 of file jlThread.h.

#define NATIVE_TABLE_JLTHREAD_JDOUBLE
 

No (jdouble) methods.

Definition at line 475 of file jlThread.h.


Enumeration Type Documentation

enum jlThread_nmo_enum
 

Enumerator:
JLTHREAD_NMO_CURRENTTHREAD  Ordinal for yield().
JLTHREAD_NMO_YIELD  Ordinal for yield().
JLTHREAD_NMO_INTERRUPT  Ordinal for interrupt().
JLTHREAD_NMO_INTERRUPTED  Ordinal for interrupted().
JLTHREAD_NMO_ISINTERRUPTED  Ordinal for isInterrupted().
JLTHREAD_NMO_SLEEP  Ordinal for sleep().
JLTHREAD_NMO_SLEEP_NANOS  Ordinal for sleep_nanos().
JLTHREAD_NMO_JOIN4EVER  Ordinal for join4ever().
JLTHREAD_NMO_JOINTIMED  Ordinal for jointimed().
JLTHREAD_NMO_JOINTIMED_NANOS  Ordinal for jointimed_nanos().
JLTHREAD_NMO_ISALIVE  Ordinal for isAlive().
JLTHREAD_NMO_START  Ordinal for holdsLock().
JLTHREAD_NMO_COUNTSTACKFRAMES  Ordinal for countStackFrames().
JLTHREAD_NMO_HOLDSLOCK  Ordinal for holdsLock().
JLTHREAD_NMO_SETPRIORITY  Ordinal for setPriority().
JLTHREAD_NMO_GETPRIORITY  Ordinal for getPriority().
JLTHREAD_NMO_DESTROY  Ordinal for destroy().
JLTHREAD_NMO_CHECKACCESS  Ordinal for checkAccess().
JLTHREAD_NMO_SETDAEMON  Ordinal for setDaemon().
JLTHREAD_NMO_ISDAEMON  Ordinal for isDaemon().
JLTHREAD_NMO_STOP  Ordinal for stop().
JLTHREAD_NMO_SUSPEND  Ordinal for stop().
JLTHREAD_NMO_RESUME  Ordinal for stop().

Definition at line 133 of file jlThread.h.


Function Documentation

jvm_object_hash jlThread_currentThread jvm_class_index  clsidxthis  ) 
 

JNI hook to currentThread().

Parameters:
clsidxthis Class table index of the class of this object, namely, java.lang.Thread .
Returns:
java.lang.Thread of pjvm->current_thread, also known as CURRENT_THREAD
< Access structures of the thread now running in the JVM.

Definition at line 308 of file jlThread.c.

References CURRENT_THREAD, jfalse, threadstate_request_badlogic(), and threadstate_request_runnable().

Referenced by Java_java_lang_Thread_currentThread(), and native_run_local_return_jobject().

jvoid jlThread_yield jvm_class_index  clsidxthis  ) 
 

JNI hook to yield().

Parameters:
clsidxthis Class table index of the class of this object, namely, java.lang.Thread .
Returns:
jtrue if thread could be modified, else jfalse.
< Access structures of the thread now running in the JVM.

Definition at line 332 of file jlThread.c.

References CURRENT_THREAD, jfalse, jtrue, THREAD, and THREAD_STATUS_INTERRUPTED.

Referenced by Java_java_lang_Thread_yield(), and native_run_local_return_jvoid().

jvoid jlThread_interrupt jvm_object_hash  objhashthis  ) 
 

JNI hook to interrupt().

The THREAD_STATUS_INTERRUPTED bit is unconditionally set here. The logic for clearing the bit and throwing exceptions is performed when this bit is read by other functions.

Parameters:
objhashthis Object table hash of this object.
Returns:
jtrue if thread could be modified, else throw SecurityException.
Exceptions:
JVMCLASS_JAVA_LANG_SECURITYEXCEPTION if thread cannot be interrupted.
< This slot contains an object

< Object is a java/Lang/Thread < This slot contains an object

< Object is a java/Lang/Thread < This slot contains an object

< Object is a java/Lang/Thread < This slot contains a thread

< This slot contains an object

< Object is a java/Lang/Thread < Null thread (only 1 exists in normal use, any else besides the JVMCFG_NULL_THREAD is a thread slot that is being initialized.)

< This slot contains an object

< Object is a java/Lang/Thread < This slot contains an object

< Object is a java/Lang/Thread < This slot contains an object

< This slot contains an object

< Object is a java/Lang/Thread < NULL object (only 1 exists in normal use, any else besides the JVMCFG_NULL_OBJECT is an object slot now being initialized.)

< This slot contains an object

< Object is a java/Lang/Thread < Object is a java/Lang/Thread < This slot contains an object

< Object is a java/Lang/Thread < thread has been interrupted

< Access structures of the thread now running in the JVM.

< thread threw a java.lang.Exception (but NOT a java.lang.Error). The object type is found in pThrowableEvent and is not rnull.

Definition at line 498 of file jlThread.c.

References jfalse, jtrue, OBJECT_THREAD_LINKAGE, rtrue, THREAD, THREAD_STATUS_INTERRUPTED, VERIFY_OBJECT_THREAD_LINKAGE, and VERIFY_THREAD_LINKAGE.

Referenced by Java_java_lang_Thread_interrupt(), and native_run_local_return_jvoid().

jboolean jlThread_interrupted jvm_object_hash  objhashTHR  ) 
 

JNI hook to interrupted().

jboolean jlThread_isInterrupted jvm_object_hash  objhashthis  ) 
 

JNI hook to isInterrupted().

Status is UNCHANGED by this method after testing it.

Parameters:
objhashthis Object table hash of this object.
Returns:
jtrue if thread has been interrupted, else jfalse.
< This slot contains an object

< Object is a java/Lang/Thread < This slot contains an object

< Object is a java/Lang/Thread < This slot contains an object

< Object is a java/Lang/Thread < This slot contains a thread

< This slot contains an object

< Object is a java/Lang/Thread < Null thread (only 1 exists in normal use, any else besides the JVMCFG_NULL_THREAD is a thread slot that is being initialized.)

< This slot contains an object

< Object is a java/Lang/Thread < This slot contains an object

< Object is a java/Lang/Thread < This slot contains an object

< This slot contains an object

< Object is a java/Lang/Thread < NULL object (only 1 exists in normal use, any else besides the JVMCFG_NULL_OBJECT is an object slot now being initialized.)

< This slot contains an object

< Object is a java/Lang/Thread < Object is a java/Lang/Thread < This slot contains an object

< Object is a java/Lang/Thread < thread has been interrupted

Definition at line 565 of file jlThread.c.

Referenced by Java_java_lang_Thread_isInterrupted(), and native_run_local_return_jint().

jboolean jlThread_sleep jvm_class_index  clsidxthis,
jlong  sleeptime_milliseconds
 

JNI hook to sleep().

< Access structures of the thread now running in the JVM.

< thread is sleeping

Definition at line 117 of file jlThread.c.

References CURRENT_THREAD, THREAD, THREAD_STATUS_SLEEP, and threadstate_request_runnable().

Referenced by Java_java_lang_Thread_sleep__J(), jlThread_sleep_nanos(), and native_run_local_return_jint().

jboolean jlThread_sleep_nanos jvm_class_index  clsidxthis,
jlong  sleeptime_milliseconds,
jint  sleeptime_nanoseconds
 

JNI hook to sleep_nanos().

Ignore the sleeptime_nanoseconds parameter in this implementation.

Definition at line 143 of file jlThread.c.

References jlThread_sleep().

Referenced by Java_java_lang_Thread_sleep__JI(), and native_run_local_return_jint().

jvoid jlThread_join4ever jvm_object_hash  objhashthis  ) 
 

JNI hook to join4ever().

< Access structures of the thread now running in the JVM.

< This slot contains an object

< Object is a java/Lang/Thread < thread has unconditionally joined another

Definition at line 201 of file jlThread.c.

Referenced by Java_java_lang_Thread_join(), and native_run_local_return_jvoid().

jvoid jlThread_jointimed jvm_object_hash  objhashthis,
jlong  sleeptime
 

JNI hook to jointimed().

< Access structures of the thread now running in the JVM.

< This slot contains an object

< Object is a java/Lang/Thread < thread has joined another, but is waiting for a finite time

Definition at line 228 of file jlThread.c.

Referenced by Java_java_lang_Thread_join__J(), and native_run_local_return_jvoid().

jvoid jlThread_jointimed_nanos jvm_object_hash  objhashthis,
jlong  sleeptime,
jint  sleeptime_nanoseconds
 

JNI hook to jointimed_nanos().

Ignore the sleeptime_nanoseconds parameter in this implementation.

Definition at line 259 of file jlThread.c.

References CURRENT_THREAD, and THREAD.

Referenced by Java_java_lang_Thread_join__JI(), and native_run_local_return_jvoid().

jboolean jlThread_isAlive jvm_object_hash  objhashthis  ) 
 

JNI hook to jointimed().

Parameters:
objhashthis Object table hash of this object.
Returns:
jtrue if thread is in use and not NEW and neither COMPLETE (transient) nor DEAD, else jfalse.
Todo:
CAVEAT: Should this thread eventually get reallocated as pjvm->thread_new_last wraps around after JVMCFG_MAX_THREADS more new threads, this function will return a stale result at the real machine level. This is unlikely, however, because the allocation of java.lang.Thread objects will likely cover this concern at a higher level in the design.
< This slot contains an object

< Object is a java/Lang/Thread < This slot contains an object

< Object is a java/Lang/Thread < This slot contains an object

< Object is a java/Lang/Thread < This slot contains a thread

< This slot contains an object

< Object is a java/Lang/Thread < Null thread (only 1 exists in normal use, any else besides the JVMCFG_NULL_THREAD is a thread slot that is being initialized.)

< This slot contains an object

< Object is a java/Lang/Thread < This slot contains an object

< Object is a java/Lang/Thread < This slot contains an object

< This slot contains an object

< Object is a java/Lang/Thread < NULL object (only 1 exists in normal use, any else besides the JVMCFG_NULL_OBJECT is an object slot now being initialized.)

< This slot contains an object

< Object is a java/Lang/Thread < Object is a java/Lang/Thread < This slot contains an object

< Object is a java/Lang/Thread

Definition at line 627 of file jlThread.c.

References CHECK_FINAL_STACK_FRAME_GENERIC, FIRST_STACK_FRAME, JVMCLASS_JAVA_LANG_ILLEGALTHREADSTATEEXCEPTION, NEXT_STACK_FRAME_GENERIC, OBJECT_THREAD_LINKAGE, rfalse, THREAD, THREAD_STATUS_INTERRUPTED, THREAD_STATUS_THREW_EXCEPTION, thread_throw_exception(), VERIFY_OBJECT_THREAD_LINKAGE, and VERIFY_THREAD_LINKAGE.

Referenced by Java_java_lang_Thread_isAlive(), and native_run_local_return_jint().

jboolean jlThread_start jvm_object_hash  objhashthis  ) 
 

JNI hook to start().

This will only succeed if thread is in NEW state.

Parameters:
objhashthis Object table hash of this object.
Returns:
jtrue if thread could be started, else jfalse.
Exceptions:
JVMCLASS_JAVA_LANG_INTERRUPTEDEXCEPTION if another thread had interrupted this thread.
< This slot contains an object

< Object is a java/Lang/Thread < This slot contains an object

< Object is a java/Lang/Thread < This slot contains an object

< Object is a java/Lang/Thread < This slot contains a thread

< This slot contains an object

< Object is a java/Lang/Thread < Null thread (only 1 exists in normal use, any else besides the JVMCFG_NULL_THREAD is a thread slot that is being initialized.)

< This slot contains an object

< Object is a java/Lang/Thread < This slot contains an object

< Object is a java/Lang/Thread < This slot contains an object

< This slot contains an object

< Object is a java/Lang/Thread < NULL object (only 1 exists in normal use, any else besides the JVMCFG_NULL_OBJECT is an object slot now being initialized.)

< This slot contains an object

< Object is a java/Lang/Thread < Object is a java/Lang/Thread < This slot contains an object

< Object is a java/Lang/Thread

Definition at line 687 of file jlThread.c.

References CURRENT_THREAD, jfalse, jtrue, JVMCLASS_JAVA_LANG_ILLEGALARGUMENTEXCEPTION, JVMCLASS_JAVA_LANG_SECURITYEXCEPTION, OBJECT_THREAD_LINKAGE, rtrue, THREAD, THREAD_PRIORITY_MAX, THREAD_PRIORITY_MIN, THREAD_STATUS_THREW_EXCEPTION, thread_throw_exception(), VERIFY_OBJECT_THREAD_LINKAGE, and VERIFY_THREAD_LINKAGE.

Referenced by Java_java_lang_Thread_start(), and native_run_local_return_jint().

jint jlThread_countStackFrames jvm_object_hash  objhashthis  ) 
 

JNI hook to countStackFrames().

Deprecated:
CAVEAT EMPTOR: This method has been deprecated in the JDK library API documentation.
Parameters:
objhashthis Object table hash of this object.
Returns:
number of frames
Exceptions:
JVMCLASS_JAVA_LANG_ILLEGALTHREADSTATEEXCEPTION if another thread had interrupted this thread.
< This slot contains an object

< Object is a java/Lang/Thread < This slot contains an object

< Object is a java/Lang/Thread < This slot contains an object

< Object is a java/Lang/Thread < This slot contains a thread

< This slot contains an object

< Object is a java/Lang/Thread < Null thread (only 1 exists in normal use, any else besides the JVMCFG_NULL_THREAD is a thread slot that is being initialized.)

< This slot contains an object

< Object is a java/Lang/Thread < This slot contains an object

< Object is a java/Lang/Thread < This slot contains an object

< This slot contains an object

< Object is a java/Lang/Thread < NULL object (only 1 exists in normal use, any else besides the JVMCFG_NULL_OBJECT is an object slot now being initialized.)

< This slot contains an object

< Object is a java/Lang/Thread < Object is a java/Lang/Thread < This slot contains an object

< Object is a java/Lang/Thread < thread has been interrupted

< thread threw a java.lang.Exception (but NOT a java.lang.Error). The object type is found in pThrowableEvent and is not rnull.

Definition at line 742 of file jlThread.c.

References OBJECT_THREAD_LINKAGE, rtrue, THREAD, THREAD_PRIORITY_BAD, VERIFY_OBJECT_THREAD_LINKAGE, and VERIFY_THREAD_LINKAGE.

Referenced by Java_java_lang_Thread_countStackFrames(), and native_run_local_return_jint().

jboolean jlThread_holdsLock jvm_class_index  clsidxthis,
jvm_object_hash  objhashLOCK
 

JNI hook to holdsLock().

Parameters:
clsidxthis Class table index of the class of this object, namely, java.lang.Thread .
objhashLOCK Object hash of object to query.
Returns:
jtrue if this thread holds the object's monitor lock, else jfalse.
Exceptions:
JVMCLASS_JAVA_LANG_NULLPOINTEREXCEPTION if the object hash is a null object.
< Access structures of the thread now running in the JVM.

< thread threw a java.lang.Exception (but NOT a java.lang.Error). The object type is found in pThrowableEvent and is not rnull.

< Access structures of the thread now running in the JVM.

Definition at line 418 of file jlThread.c.

Referenced by Java_java_lang_Thread_holdsLock(), and native_run_local_return_jint().

jboolean jlThread_setPriority jvm_object_hash  objhashthis,
jint  priority
 

JNI hook to setPriority().

Parameters:
objhashthis Object table hash of this object.
priority new priority value
Returns:
If this thread is in use, result is jtrue, else jfalse.
Exceptions:
JVMCLASS_JAVA_LANG_ILLEGALARGUMENTEXCEPTION if the requested thread priorty is out of range.
JVMCLASS_JAVA_LANG_SECURITYEXCEPTION if this thread cannot have its priority modified.
Todo:
Add logic to detect SecurityException.
< Access structures of the thread now running in the JVM.

< thread threw a java.lang.Exception (but NOT a java.lang.Error). The object type is found in pThrowableEvent and is not rnull.

< This slot contains an object

< Object is a java/Lang/Thread < This slot contains an object

< Object is a java/Lang/Thread < This slot contains an object

< Object is a java/Lang/Thread < This slot contains a thread

< This slot contains an object

< Object is a java/Lang/Thread < Null thread (only 1 exists in normal use, any else besides the JVMCFG_NULL_THREAD is a thread slot that is being initialized.)

< This slot contains an object

< Object is a java/Lang/Thread < This slot contains an object

< Object is a java/Lang/Thread < This slot contains an object

< This slot contains an object

< Object is a java/Lang/Thread < NULL object (only 1 exists in normal use, any else besides the JVMCFG_NULL_OBJECT is an object slot now being initialized.)

< This slot contains an object

< Object is a java/Lang/Thread < Object is a java/Lang/Thread < This slot contains an object

< Object is a java/Lang/Thread

Definition at line 831 of file jlThread.c.

References CURRENT_THREAD, jfalse, jtrue, JVMCLASS_JAVA_LANG_SECURITYEXCEPTION, OBJECT_THREAD_LINKAGE, rtrue, THREAD_STATUS_THREW_EXCEPTION, thread_throw_exception(), VERIFY_OBJECT_THREAD_LINKAGE, and VERIFY_THREAD_LINKAGE.

Referenced by Java_java_lang_Thread_setPriority(), and native_run_local_return_jint().

jint jlThread_getPriority jvm_object_hash  objhashthis  ) 
 

JNI hook to getPriority().

Parameters:
objhashthis Object table hash of this object.
Returns:
Execution priority of this thread. If not in use, result is THREAD_PRIORITY_BAD.
< This slot contains an object

< Object is a java/Lang/Thread < This slot contains an object

< Object is a java/Lang/Thread < This slot contains an object

< Object is a java/Lang/Thread < This slot contains a thread

< This slot contains an object

< Object is a java/Lang/Thread < Null thread (only 1 exists in normal use, any else besides the JVMCFG_NULL_THREAD is a thread slot that is being initialized.)

< This slot contains an object

< Object is a java/Lang/Thread < This slot contains an object

< Object is a java/Lang/Thread < This slot contains an object

< This slot contains an object

< Object is a java/Lang/Thread < NULL object (only 1 exists in normal use, any else besides the JVMCFG_NULL_OBJECT is an object slot now being initialized.)

< This slot contains an object

< Object is a java/Lang/Thread < Object is a java/Lang/Thread < This slot contains an object

< Object is a java/Lang/Thread

Definition at line 914 of file jlThread.c.

References CURRENT_THREAD, JVMCLASS_JAVA_LANG_SECURITYEXCEPTION, THREAD_STATUS_THREW_EXCEPTION, and thread_throw_exception().

Referenced by Java_java_lang_Thread_getPriority(), and native_run_local_return_jint().

jboolean jlThread_destroy jvm_object_hash  objhashthis  ) 
 

JNI hook to destroy().

Simply kill the thread without any cleanup. THIS IS A VERY BAD THING! (Perhaps this is why most JDK's do not implement this method any more!)

There is typically no implementation done of java.lang.Thread.destroy(Runnable) , but will initially be done here.

Todo:
Should this be implemented? Some JDK's probably don't implement it any more.
Parameters:
objhashthis Object table hash of this object.
Returns:
jtrue if thread was moved to COMPLETE state, else jfalse.
< This slot contains an object

< Object is a java/Lang/Thread < This slot contains an object

< Object is a java/Lang/Thread < This slot contains an object

< Object is a java/Lang/Thread < This slot contains a thread

< This slot contains an object

< Object is a java/Lang/Thread < Null thread (only 1 exists in normal use, any else besides the JVMCFG_NULL_THREAD is a thread slot that is being initialized.)

< This slot contains an object

< Object is a java/Lang/Thread < This slot contains an object

< Object is a java/Lang/Thread < This slot contains an object

< This slot contains an object

< Object is a java/Lang/Thread < NULL object (only 1 exists in normal use, any else besides the JVMCFG_NULL_OBJECT is an object slot now being initialized.)

< This slot contains an object

< Object is a java/Lang/Thread < Object is a java/Lang/Thread < This slot contains an object

< Object is a java/Lang/Thread

Definition at line 973 of file jlThread.c.

References jfalse, jtrue, OBJECT_THREAD_LINKAGE, THREAD, and THREAD_STATUS_ISDAEMON.

Referenced by Java_java_lang_Thread_destroy(), and native_run_local_return_jint().

jboolean jlThread_checkAccess jvm_object_hash  objhashthis  ) 
 

JNI hook to checkAccess().

This method will always give permission in this JVM.

Todo:
A smart java.lang.SecurityManager will take care of this matter.
Parameters:
objhashthis Object table hash of this object.
Returns:
jtrue unconditionally.
Exceptions:
JVMCLASS_JAVA_LANG_SECURITYEXCEPTION if current thread is not permitted to modify this thread.
Todo:
Add logic to detect SecurityException beyond passing in an invalid objhashthis.
< This slot contains an object

< Object is a java/Lang/Thread < This slot contains an object

< Object is a java/Lang/Thread < This slot contains an object

< Object is a java/Lang/Thread < This slot contains a thread

< This slot contains an object

< Object is a java/Lang/Thread < Null thread (only 1 exists in normal use, any else besides the JVMCFG_NULL_THREAD is a thread slot that is being initialized.)

< This slot contains an object

< Object is a java/Lang/Thread < This slot contains an object

< Object is a java/Lang/Thread < This slot contains an object

< This slot contains an object

< Object is a java/Lang/Thread < NULL object (only 1 exists in normal use, any else besides the JVMCFG_NULL_OBJECT is an object slot now being initialized.)

< This slot contains an object

< Object is a java/Lang/Thread < Object is a java/Lang/Thread < Access structures of the thread now running in the JVM.

< thread threw a java.lang.Exception (but NOT a java.lang.Error). The object type is found in pThrowableEvent and is not rnull.

Definition at line 1037 of file jlThread.c.

References OBJECT_THREAD_LINKAGE, rtrue, THREAD, VERIFY_OBJECT_THREAD_LINKAGE, and VERIFY_THREAD_LINKAGE.

Referenced by Java_java_lang_Thread_checkAccess(), and native_run_local_return_jint().

jvoid jlThread_setDaemon jvm_object_hash  objhashthis,
jboolean  isdaemon
 

JNI hook to setDaemon().

Todo:
See notes elsewhere about implementation of the ISDAEMON bit. This concept must be implemented in the JVM structures so as to know when to quit (no non-daemon threads running, that is, no user threads running). Currently, it is a status bit in the rthread.status structure named THREAD_STATUS_ISDAEMON but is typically also found as a private class member of java.lang.Thread . If this were always true, then the former could be eliminated. Since this code actually implements this class' native methods, either one could be eliminated if none of the other (non-native) class methods referenced the private variable without going through jlThread_isDaemon. However, this question is why this action item is present.
Parameters:
objhashthis Object table hash of this object.
isdaemon rtrue or rfalse, depending on requested condition
Returns:
jtrue if could make the change, else throw SecurityException.
Exceptions:
JVMCLASS_JAVA_LANG_ILLEGALTHREADSTATEEXCEPTION if thread is not in the NEW state when attempting to set this condition.
JVMCLASS_JAVA_LANG_SECURITYEXCEPTION if current thread cannot change this thread.
Todo:
Review jvm_init() code for setting up threads before there is a setjmp(3) handler for setDaemon() exceptions.
Todo:
Add logic to detect SecurityException beyond passing in an invalid objhashthis.
< This slot contains an object

< Object is a java/Lang/Thread < This slot contains an object

< Object is a java/Lang/Thread < This slot contains an object

< Object is a java/Lang/Thread < This slot contains a thread

< This slot contains an object

< Object is a java/Lang/Thread < Null thread (only 1 exists in normal use, any else besides the JVMCFG_NULL_THREAD is a thread slot that is being initialized.)

< This slot contains an object

< Object is a java/Lang/Thread < This slot contains an object

< Object is a java/Lang/Thread < This slot contains an object

< This slot contains an object

< Object is a java/Lang/Thread < NULL object (only 1 exists in normal use, any else besides the JVMCFG_NULL_OBJECT is an object slot now being initialized.)

< This slot contains an object

< Object is a java/Lang/Thread < Object is a java/Lang/Thread < Access structures of the thread now running in the JVM.

< thread threw a java.lang.Exception (but NOT a java.lang.Error). The object type is found in pThrowableEvent and is not rnull.

< This slot contains an object

< Object is a java/Lang/Thread < Daemon thread state, vs user thread, per Thread.isdaemon()

< Daemon thread state, vs user thread, per Thread.isdaemon()

< thread threw a java.lang.Exception (but NOT a java.lang.Error). The object type is found in pThrowableEvent and is not rnull.

Definition at line 1136 of file jlThread.c.

References CURRENT_THREAD, JVMCLASS_JAVA_LANG_SECURITYEXCEPTION, OBJECT_THREAD_LINKAGE, rtrue, THREAD, THREAD_STATUS_SUSPEND, THREAD_STATUS_THREW_EXCEPTION, thread_throw_exception(), threadstate_activate_badlogic(), threadstate_request_badlogic(), threadstate_request_blockingevent(), VERIFY_OBJECT_THREAD_LINKAGE, and VERIFY_THREAD_LINKAGE.

Referenced by Java_java_lang_Thread_setDaemon(), and native_run_local_return_jvoid().

jboolean jlThread_isDaemon jvm_object_hash  objhashthis  ) 
 

JNI hook to isDaemon().

Todo:
See notes elsewhere about implementation of the ISDAEMON bit.
Parameters:
objhashthis Object table hash of this object.
Returns:
jtrue or jfalse, depending on value of ISDAEMON bit.
< This slot contains an object

< Object is a java/Lang/Thread < This slot contains an object

< Object is a java/Lang/Thread < This slot contains an object

< Object is a java/Lang/Thread < This slot contains a thread

< This slot contains an object

< Object is a java/Lang/Thread < Null thread (only 1 exists in normal use, any else besides the JVMCFG_NULL_THREAD is a thread slot that is being initialized.)

< This slot contains an object

< Object is a java/Lang/Thread < This slot contains an object

< Object is a java/Lang/Thread < This slot contains an object

< This slot contains an object

< Object is a java/Lang/Thread < NULL object (only 1 exists in normal use, any else besides the JVMCFG_NULL_OBJECT is an object slot now being initialized.)

< This slot contains an object

< Object is a java/Lang/Thread < Object is a java/Lang/Thread < This slot contains an object

< Object is a java/Lang/Thread < Daemon thread state, vs user thread, per Thread.isdaemon()

Definition at line 1230 of file jlThread.c.

References CURRENT_THREAD, JVMCLASS_JAVA_LANG_SECURITYEXCEPTION, OBJECT_THREAD_LINKAGE, rtrue, THREAD, THREAD_STATE_BADLOGIC, THREAD_STATE_BLOCKED, THREAD_STATE_BLOCKINGEVENT, THREAD_STATUS_SUSPEND, THREAD_STATUS_THREW_EXCEPTION, thread_throw_exception(), threadstate_activate_blocked(), threadstate_activate_blockingevent(), threadstate_process_blocked(), threadstate_process_blockingevent(), threadstate_request_blocked(), threadstate_request_blockingevent(), threadstate_request_unblocked(), VERIFY_OBJECT_THREAD_LINKAGE, and VERIFY_THREAD_LINKAGE.

Referenced by Java_java_lang_Thread_isDaemon(), and native_run_local_return_jint().

jvoid jlThread_stop jvm_object_hash  objhashthis  ) 
 

JNI hook to stop().

There is typically no native implementation of java.lang.Thread.stop(Runnable) .

Deprecated:
CAVEAT EMPTOR: This method has been deprecated in the JDK library API documentation.
Parameters:
objhashthis Object table hash of this object.
Returns:
jtrue if thread could be modified, else throw SecurityException
Exceptions:
JVMCLASS_JAVA_LANG_SECURITYEXCEPTION if current thread cannot change this thread.
Todo:
Add logic to detect SecurityException beyond passing in an invalid objhashthis.
< This slot contains an object

< Object is a java/Lang/Thread < This slot contains an object

< Object is a java/Lang/Thread < This slot contains an object

< Object is a java/Lang/Thread < This slot contains a thread

< This slot contains an object

< Object is a java/Lang/Thread < Null thread (only 1 exists in normal use, any else besides the JVMCFG_NULL_THREAD is a thread slot that is being initialized.)

< This slot contains an object

< Object is a java/Lang/Thread < This slot contains an object

< Object is a java/Lang/Thread < This slot contains an object

< This slot contains an object

< Object is a java/Lang/Thread < NULL object (only 1 exists in normal use, any else besides the JVMCFG_NULL_OBJECT is an object slot now being initialized.)

< This slot contains an object

< Object is a java/Lang/Thread < Object is a java/Lang/Thread < Access structures of the thread now running in the JVM.

< thread threw a java.lang.Exception (but NOT a java.lang.Error). The object type is found in pThrowableEvent and is not rnull.

< This slot contains an object

< Object is a java/Lang/Thread < This slot contains an object

< Object monitor locked by mlock_thridx

< Object monitor locked by mlock_thridx

Definition at line 1364 of file jlThread.c.

Referenced by Java_java_lang_Thread_stop(), and native_run_local_return_jvoid().

jvoid jlThread_suspend jvm_object_hash  objhashthis  ) 
 

JNI hook to suspend().

Results are undefined if thread has the SLEEP, WAIT4EVER, WAITTIMED, or INTERRUPTIBLEIO status or if thread has been NOTIFIED or INTERRUPTED.

This will work if thread is in any state at all.

Deprecated:
CAVEAT EMPTOR: This method has been deprecated in the JDK library API documentation.
Parameters:
objhashthis Object table hash of this object.
Returns:
jtrue if thread could be modified, else throw SecurityException.
Exceptions:
JVMCLASS_JAVA_LANG_SECURITYEXCEPTION if could not suspend thread.
Todo:
Add logic to detect SecurityException beyond passing in an invalid objhashthis.
< This slot contains an object

< Object is a java/Lang/Thread < This slot contains an object

< Object is a java/Lang/Thread < This slot contains an object

< Object is a java/Lang/Thread < This slot contains a thread

< This slot contains an object

< Object is a java/Lang/Thread < Null thread (only 1 exists in normal use, any else besides the JVMCFG_NULL_THREAD is a thread slot that is being initialized.)

< This slot contains an object

< Object is a java/Lang/Thread < This slot contains an object

< Object is a java/Lang/Thread < This slot contains an object

< This slot contains an object

< Object is a java/Lang/Thread < NULL object (only 1 exists in normal use, any else besides the JVMCFG_NULL_OBJECT is an object slot now being initialized.)

< This slot contains an object

< Object is a java/Lang/Thread < Object is a java/Lang/Thread < This slot contains an object

< Object is a java/Lang/Thread < thread is suspended, can be resumed

< Access structures of the thread now running in the JVM.

< thread threw a java.lang.Exception (but NOT a java.lang.Error). The object type is found in pThrowableEvent and is not rnull.

Definition at line 1476 of file jlThread.c.

Referenced by Java_java_lang_Thread_suspend(), and native_run_local_return_jvoid().

jvoid jlThread_resume jvm_object_hash  objhashthis  ) 
 

JNI hook to resume().

Results are undefined if thread has the SLEEP, WAIT4EVER, WAITTIMED, or INTERRUPTIBLEIO status or if thread has been NOTIFIED or INTERRUPTED.

This will work if thread is in any state at all.

Deprecated:
CAVEAT EMPTOR: This method has been deprecated in the JDK library API documentation.
Parameters:
objhashthis Object table hash of this object.
Returns:
jtrue if thread could be modified, else throw SecurityException.
Exceptions:
JVMCLASS_JAVA_LANG_SECURITYEXCEPTION if could not suspend thread.
Todo:
Add logic to detect SecurityException beyond passing in an invalid objhashthis.
< This slot contains an object

< Object is a java/Lang/Thread < This slot contains an object

< Object is a java/Lang/Thread < This slot contains an object

< Object is a java/Lang/Thread < This slot contains a thread

< This slot contains an object

< Object is a java/Lang/Thread < Null thread (only 1 exists in normal use, any else besides the JVMCFG_NULL_THREAD is a thread slot that is being initialized.)

< This slot contains an object

< Object is a java/Lang/Thread < This slot contains an object

< Object is a java/Lang/Thread < This slot contains an object

< This slot contains an object

< Object is a java/Lang/Thread < NULL object (only 1 exists in normal use, any else besides the JVMCFG_NULL_OBJECT is an object slot now being initialized.)

< This slot contains an object

< Object is a java/Lang/Thread < Object is a java/Lang/Thread < This slot contains an object

< Object is a java/Lang/Thread < thread is suspended, can be resumed

< Access structures of the thread now running in the JVM.

< thread threw a java.lang.Exception (but NOT a java.lang.Error). The object type is found in pThrowableEvent and is not rnull.

Definition at line 1568 of file jlThread.c.

Referenced by Java_java_lang_Thread_resume(), and native_run_local_return_jvoid().


Generated on Fri Sep 30 18:59:50 2005 by  doxygen 1.4.4