java.lang.Thread structure
in this real machine implementation.
There is no notion of a thread group natively in this JVM. Thread groups are supported at the class library level.
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.
Definition in file thread.h.
#include <setjmp.h>
#include "jvmreg.h"
Go to the source code of this file.
Data Structures | ||||
struct | rthread | |||
Real machine thread model implementation. More... | ||||
Macros for addressing threads | ||||
| ||||
#define | CURRENT_THREAD pjvm->current_thread | |||
Access structures of the thread now running in the JVM. | ||||
#define | CURRENT_THREAD_ACTIVATE_THIS_STATE(state) threadstate_activate_##state(CURRENT_THREAD) | |||
Activate current thread state, actually moving it from a prior state into a requested state, see threadstate_activate_XXX() for specifics. | ||||
#define | CURRENT_THREAD_PROCESS_THIS_STATE(state) threadstate_process_##state(CURRENT_THREAD) | |||
Process activities for current thread in its current state, see threadstate_process_XXX() for specifics. | ||||
#define | CURRENT_THREAD_REQUEST_NEXT_STATE(state) REQ_NEXT_STATE(state, CURRENT_THREAD) | |||
Request that the current thread move into a certain thread state, see threadstate_request_XXX() for specifics. | ||||
#define | NEXT_STATE(thridx) THREAD(thridx).next_state | |||
Next requested thread state. | ||||
#define | PREV_STATE(thridx) THREAD(thridx).prev_state | |||
Previous actual thread state. | ||||
#define | REQ_NEXT_STATE(state, thridx) threadstate_request_##state(thridx) | |||
Place a thread into requested thread state, see threadstate_request_XXX() for specifics. | ||||
#define | THIS_STATE(thridx) THREAD(thridx).this_state | |||
This current thread state. | ||||
#define | THREAD(thridx) pjvm->thread[thridx] | |||
Access structures of thread table at certain index. | ||||
#define | THREAD_ACTIVATE_THIS_STATE(state, thridx) threadstate_activate_##state(thridx) | |||
Activate arbitrary thread state, actually moving it from a prior state into a requested state, see threadstate_activate_XXX() for specifics. | ||||
#define | THREAD_PROCESS_THIS_STATE(state, thridx) threadstate_process_##state(thridx) | |||
Process activities for an arbitrary thread in its current state, see threadstate_process_XXX() for specifics. | ||||
#define | THREAD_REQUEST_NEXT_STATE(state, thridx) REQ_NEXT_STATE(state, thridx) | |||
Request that an arbitrary thread move into a certain thread state, see threadstate_request_XXX() for specifics. | ||||
Thread state name strings | ||||
#define | THREAD_STATE_ACQUIRE_DESC "acquire" | |||
#define | THREAD_STATE_BADLOGIC_DESC "bad_logic" | |||
#define | THREAD_STATE_BLOCKED_DESC "blocked" | |||
#define | THREAD_STATE_BLOCKINGEVENT_DESC "blockingevent" | |||
#define | THREAD_STATE_COMPLETE_DESC "complete" | |||
#define | THREAD_STATE_DEAD_DESC "dead" | |||
#define | THREAD_STATE_ILLEGAL_DESC "illegal" | |||
#define | THREAD_STATE_LOCK_DESC "lock" | |||
#define | THREAD_STATE_NEW_DESC "new" | |||
#define | THREAD_STATE_NOTIFY_DESC "notify" | |||
#define | THREAD_STATE_RELEASE_DESC "release" | |||
#define | THREAD_STATE_RUNNABLE_DESC "runnable" | |||
#define | THREAD_STATE_RUNNING_DESC "running" | |||
#define | THREAD_STATE_START_DESC "started" | |||
#define | THREAD_STATE_SYNCHRONIZED_DESC "synchronized" | |||
#define | THREAD_STATE_UNBLOCKED_DESC "unblocked" | |||
#define | THREAD_STATE_WAIT_DESC "wait" | |||
const rchar * | thread_state_name | |||
Thread state machine state definitions. | ||||
Thread state machine state names, including min and max states. | ||||
#define | THREAD_STATE_MAX_STATE THREAD_STATE_BADLOGIC | |||
Highest possible state number. | ||||
#define | THREAD_STATE_MIN_STATE THREAD_STATE_NEW | |||
Lowest possible state number. | ||||
enum | thread_state_enum { THREAD_STATE_NEW = 0, THREAD_STATE_START = 1, THREAD_STATE_RUNNABLE = 2, THREAD_STATE_RUNNING = 3, THREAD_STATE_COMPLETE = 4, THREAD_STATE_BLOCKINGEVENT = 5, THREAD_STATE_BLOCKED = 6, THREAD_STATE_UNBLOCKED = 7, THREAD_STATE_SYNCHRONIZED = 8, THREAD_STATE_RELEASE = 9, THREAD_STATE_WAIT = 10, THREAD_STATE_NOTIFY = 11, THREAD_STATE_LOCK = 12, THREAD_STATE_ACQUIRE = 13, THREAD_STATE_DEAD = 14, THREAD_STATE_BADLOGIC = 15 } | |||
JVM state priority definitions. | ||||
enum | thread_priority_enum { THREAD_PRIORITY_BAD = 0, THREAD_PRIORITY_MIN = 1, THREAD_PRIORITY_NORM = 5, THREAD_PRIORITY_MAX = 10 } | |||
Thread state phases. | ||||
Each thread state has three phases, each of which is handled by a dedicated function. Requesting a state checks to see if a transition from the current state into the requested state is valid. If so, the NEXT state is set to the requested one. If not, the request is ignored. Activating a state moves the thread into the requested NEXT state so its THIS state changes. Its PREV state then reports the former state. Processing a state performs the activities for that state.
| ||||
rboolean | threadstate_activate_acquire (jvm_thread_index thridx) | |||
Activate the ACQUIRE thread state of a thread known to be coming from a valid previous state. | ||||
rboolean | threadstate_activate_badlogic (jvm_thread_index thridx) | |||
Activate the BADLOGIC thread state of a thread known to be coming from a valid previous state. | ||||
rboolean | threadstate_activate_blocked (jvm_thread_index thridx) | |||
Activate the BLOCKED thread state of a thread known to be coming from a valid previous state. | ||||
rboolean | threadstate_activate_blockingevent (jvm_thread_index thridx) | |||
Activate the BLOCKINGEVENT thread state of a thread known to be coming from a valid previous state. | ||||
rboolean | threadstate_activate_complete (jvm_thread_index thridx) | |||
Activate the COMPLETE thread state of a thread known to be coming from a valid previous state. | ||||
rboolean | threadstate_activate_dead (jvm_thread_index thridx) | |||
Activate the DEAD thread state of a thread known to be coming from a valid previous state. | ||||
rboolean | threadstate_activate_lock (jvm_thread_index thridx) | |||
Activate the LOCK thread state of a thread known to be coming from a valid previous state. | ||||
rboolean | threadstate_activate_new (jvm_thread_index thridx) | |||
Activate the NEW thread state for a new thread. | ||||
rboolean | threadstate_activate_notify (jvm_thread_index thridx) | |||
Activate the NOTIFY thread state of a thread known to be coming from a valid previous state. | ||||
rboolean | threadstate_activate_release (jvm_thread_index thridx) | |||
Activate the RELEASE thread state of a thread known to be coming from a valid previous state. | ||||
rboolean | threadstate_activate_runnable (jvm_thread_index thridx) | |||
Activate the RUNNABLE thread state of a thread known to be coming from a valid previous state. | ||||
rboolean | threadstate_activate_running (jvm_thread_index thridx) | |||
Activate the RUNNING thread state of a thread known to be coming from a valid previous state. | ||||
rboolean | threadstate_activate_start (jvm_thread_index thridx) | |||
Activate the START thread state of a thread known to be coming from a valid previous state. | ||||
rboolean | threadstate_activate_synchronized (jvm_thread_index thridx) | |||
Activate the SYNCHRONIZED thread state of a thread known to be coming from a valid previous state. | ||||
rboolean | threadstate_activate_unblocked (jvm_thread_index thridx) | |||
Activate the UNBLOCKED thread state of a thread known to be coming from a valid previous state. | ||||
rboolean | threadstate_activate_wait (jvm_thread_index thridx) | |||
Activate the WAIT thread state of a thread known to be coming from a valid previous state. | ||||
rboolean | threadstate_process_acquire (jvm_thread_index thridx) | |||
Process the ACQUIRE thread state. | ||||
rboolean | threadstate_process_badlogic (jvm_thread_index thridx) | |||
Process the BADLOGIC thread state. | ||||
rboolean | threadstate_process_blocked (jvm_thread_index thridx) | |||
Process the BLOCKED thread state. | ||||
rboolean | threadstate_process_blockingevent (jvm_thread_index thridx) | |||
Process the BLOCKINGEVENT thread state. | ||||
rboolean | threadstate_process_complete (jvm_thread_index thridx) | |||
Process the COMPLETE thread state. | ||||
rboolean | threadstate_process_dead (jvm_thread_index thridx) | |||
Process the DEAD thread state. | ||||
rboolean | threadstate_process_lock (jvm_thread_index thridx) | |||
Process the LOCK thread state. | ||||
rboolean | threadstate_process_new (jvm_thread_index thridx) | |||
Process the NEW thread state. | ||||
rboolean | threadstate_process_notify (jvm_thread_index thridx) | |||
Process the NOTIFY thread state. | ||||
rboolean | threadstate_process_release (jvm_thread_index thridx) | |||
Process the RELEASE thread state. | ||||
rboolean | threadstate_process_runnable (jvm_thread_index thridx) | |||
Process the RUNNABLE thread state. | ||||
rboolean | threadstate_process_running (jvm_thread_index thridx) | |||
Process the RUNNING thread state. | ||||
rboolean | threadstate_process_start (jvm_thread_index thridx) | |||
Process the START thread state. | ||||
rboolean | threadstate_process_synchronized (jvm_thread_index thridx) | |||
Process the SYNCHRONIZED thread state. | ||||
rboolean | threadstate_process_unblocked (jvm_thread_index thridx) | |||
Process the UNBLOCKED thread state. | ||||
rboolean | threadstate_process_wait (jvm_thread_index thridx) | |||
Process the WAIT thread state. | ||||
rboolean | threadstate_request_acquire (jvm_thread_index thridx) | |||
Request the ACQUIRE state. | ||||
rboolean | threadstate_request_badlogic (jvm_thread_index thridx) | |||
Request the BADLOGIC state. | ||||
rboolean | threadstate_request_blocked (jvm_thread_index thridx) | |||
Request the BLOCKED state. | ||||
rboolean | threadstate_request_blockingevent (jvm_thread_index thridx) | |||
Request the BLOCKINGEVENT state. | ||||
rboolean | threadstate_request_complete (jvm_thread_index thridx) | |||
Request the COMPLETE state. | ||||
rboolean | threadstate_request_dead (jvm_thread_index thridx) | |||
Request the DEAD state. | ||||
rboolean | threadstate_request_lock (jvm_thread_index thridx) | |||
Request the LOCK state. | ||||
rboolean | threadstate_request_new (jvm_thread_index thridx) | |||
Request the NEW thread state. | ||||
rboolean | threadstate_request_notify (jvm_thread_index thridx) | |||
Request the NOTIFY state. | ||||
rboolean | threadstate_request_release (jvm_thread_index thridx) | |||
Request the RELEASE state. | ||||
rboolean | threadstate_request_runnable (jvm_thread_index thridx) | |||
Request the RUNNABLE state. | ||||
rboolean | threadstate_request_running (jvm_thread_index thridx) | |||
Request the RUNNING state. | ||||
rboolean | threadstate_request_start (jvm_thread_index thridx) | |||
Request the START state. | ||||
rboolean | threadstate_request_synchronized (jvm_thread_index thridx) | |||
Request the SYNCHRONIZED state. | ||||
rboolean | threadstate_request_unblocked (jvm_thread_index thridx) | |||
Request the UNBLOCKED state. | ||||
rboolean | threadstate_request_wait (jvm_thread_index thridx) | |||
Request the WAIT state. | ||||
Defines | ||||
#define | THREAD_NAME_MAX_LEN 64 | |||
Arbitrary max thread name length. | ||||
#define | THREAD_STATUS_EMPTY 0x0000 | |||
This slot is available for use. | ||||
#define | THREAD_STATUS_INTERRUPTED 0x0800 | |||
thread has been interrupted | ||||
#define | THREAD_STATUS_INTERRUPTIBLEIO 0x0200 | |||
thread is waiting on an interruptable I/O channel in class java.nio.channels.InterruptibleChannel | ||||
#define | THREAD_STATUS_INUSE 0x0001 | |||
This slot contains a thread. | ||||
#define | THREAD_STATUS_ISDAEMON 0x0004 | |||
Daemon thread state, vs user thread, per Thread.isdaemon(). | ||||
#define | THREAD_STATUS_JOIN4EVER 0x0010 | |||
thread has unconditionally joined another | ||||
#define | THREAD_STATUS_JOINTIMED 0x0020 | |||
thread has joined another, but is waiting for a finite time | ||||
#define | THREAD_STATUS_NOTIFIED 0x0400 | |||
thread has been notified | ||||
#define | THREAD_STATUS_NULL 0x0002 | |||
Null thread (only 1 exists in normal use, any else besides the JVMCFG_NULL_THREAD is a thread slot that is being initialized. | ||||
#define | THREAD_STATUS_SLEEP 0x0008 | |||
thread is sleeping | ||||
#define | THREAD_STATUS_SUSPEND 0x0100 | |||
thread is suspended, can be resumed | ||||
#define | THREAD_STATUS_THREW_ERROR 0x2000 | |||
thread threw a java.lang.Error (but NOT a java.lang.Exception) . | ||||
#define | THREAD_STATUS_THREW_EXCEPTION 0x1000 | |||
thread threw a java.lang.Exception (but NOT a java.lang.Error) . | ||||
#define | THREAD_STATUS_THREW_THROWABLE 0x4000 | |||
thread threw a java.lang.Throwable of unknowable type. | ||||
#define | THREAD_STATUS_THREW_UNCAUGHT 0x8000 | |||
A java.lang.Throwable of some type was thrown, but not handled by the Java code itself. | ||||
#define | THREAD_STATUS_WAIT4EVER 0x0040 | |||
thread is unconditionally waiting | ||||
#define | THREAD_STATUS_WAITTIMED 0x0080 | |||
thread is waiting, but finite time | ||||
Functions | ||||
ARCH_COPYRIGHT_APACHE (thread, h,"$URL: https://svn.apache.org/path/name/thread.h $ $Id: thread.h 0 09/28/2005 dlydick $") | ||||
jvm_thread_index | thread_class_load (rchar *clsname, rchar *mthname, rchar *mthdesc, rint priority, rboolean isdaemon, rboolean usesystemthread, rboolean find_registerNatives) | |||
Load a class onto a thread during JVM initialization. | ||||
rboolean | thread_die (jvm_thread_index thridx) | |||
Terminate and deallocate a thread that is currently in the DEAD state. | ||||
int | thread_exception_setup (jvm_thread_index thridx) | |||
Set up JVM thread-relative exception handler-- implements setjmp(3)/longjmp(3 ). | ||||
rvoid | thread_init (rvoid) | |||
rvoid | thread_shutdown (rvoid) | |||
const rchar * | thread_state_get_name (rushort state) | |||
Map state numbers to state names. | ||||
rvoid | thread_throw_exception (jvm_thread_index thridx, rushort thread_status_bits, rchar *exception_name) | |||
Global handler setup for JVM thread errors and exceptions-- implements setjmp(3). | ||||
rboolean | threadutil_holds_lock (jvm_thread_index thridx, jvm_object_hash objhashlock) | |||
Examine an object to see if a thread owns its monitor lock. | ||||
rvoid | threadutil_update_blockingevents (jvm_thread_index thridxcurr) | |||
Complete the UNtimed Thread.join() request and allow threads that have joined this one to resume execution. | ||||
rvoid | threadutil_update_lock (jvm_thread_index thridxcurr) | |||
rvoid | threadutil_update_sleeptime_interval (rvoid) | |||
Update the interval timer for this thread from java.lang.Thread.sleep() or from a timed java.lang.Thread.wait() or java.lang.Thread.join(). | ||||
rvoid | threadutil_update_wait (jvm_thread_index thridxcurr) |
|
Access structures of thread table at certain index.
The thread table, being an array of slots, provides space for one thread instance per slot. This macro references one of them using the
Definition at line 75 of file thread.h. Referenced by jlObject_wait4ever(), jlThread_checkAccess(), jlThread_countStackFrames(), jlThread_destroy(), jlThread_interrupt(), jlThread_isAlive(), jlThread_isDaemon(), jlThread_jointimed_nanos(), jlThread_setDaemon(), jlThread_sleep(), jlThread_start(), jlThread_yield(), jvmutil_print_errtype_stack(), object_run_method(), objectutil_synchronize(), opcode_run(), thread_init(), thread_new_common(), thread_shutdown(), thread_state_get_name(), threadstate_process_blockingevent(), threadutil_update_sleeptime_interval(), threadutil_update_wait(), and timeslice_get_thread_sleeptime(). |
|
Access structures of the thread now running in the JVM.
Definition at line 77 of file thread.h. Referenced by exit_throw_exception(), jlObject_wait4ever(), jlThread_currentThread(), jlThread_getPriority(), jlThread_interrupted(), jlThread_isDaemon(), jlThread_jointimed_nanos(), jlThread_setDaemon(), jlThread_setPriority(), jlThread_sleep(), jlThread_start(), jlThread_yield(), objectutil_synchronize(), opcode_run(), and thread_init(). |
|
Previous actual thread state.
Definition at line 82 of file thread.h. Referenced by jvm_run(). |
|
This current thread state.
Definition at line 87 of file thread.h. Referenced by jvm_run(), threadstate_activate_start(), threadstate_activate_unblocked(), threadstate_process_blocked(), threadstate_process_running(), threadstate_request_release(), threadstate_request_runnable(), and threadstate_request_running(). |
|
Next requested thread state.
Definition at line 92 of file thread.h. Referenced by jvm_run(). |
|
Place a thread into requested thread state, see threadstate_request_XXX() for specifics.
|
|
Request that the current thread move into a certain thread state, see threadstate_request_XXX() for specifics.
Definition at line 107 of file thread.h. Referenced by jvm_run(). |
|
Request that an arbitrary thread move into a certain thread state, see threadstate_request_XXX() for specifics.
Definition at line 118 of file thread.h. Referenced by opcode_run(). |
|
Activate current thread state, actually moving it from a prior state into a requested state, see threadstate_activate_XXX() for specifics.
|
|
Activate arbitrary thread state, actually moving it from a prior state into a requested state, see threadstate_activate_XXX() for specifics.
|
|
Process activities for current thread in its current state, see threadstate_process_XXX() for specifics.
|
|
Process activities for an arbitrary thread in its current state, see threadstate_process_XXX() for specifics.
|
|
Lowest possible state number.
|
|
Highest possible state number.
|
|
Arbitrary max thread name length.
Definition at line 283 of file thread.h. Referenced by thread_init(). |
|
This slot is available for use.
DO NOT CHANGE since this is also the normal Definition at line 293 of file thread.h. Referenced by opcode_load_run_throwable(), opcode_run(), and thread_init(). |
|
This slot contains a thread.
Definition at line 301 of file thread.h. Referenced by thread_init(), thread_state_get_name(), and threadutil_update_sleeptime_interval(). |
|
Null thread (only 1 exists in normal use, any else besides the JVMCFG_NULL_THREAD is a thread slot that is being initialized. ) Definition at line 302 of file thread.h. Referenced by thread_init(). |
|
Daemon thread state, vs user thread, per Thread.isdaemon().
Definition at line 309 of file thread.h. Referenced by jlThread_destroy(). |
|
thread is sleeping
Definition at line 312 of file thread.h. Referenced by jlThread_sleep(), and threadutil_update_sleeptime_interval(). |
|
thread has unconditionally joined another
Definition at line 314 of file thread.h. Referenced by threadstate_process_blockingevent(). |
|
thread has joined another, but is waiting for a finite time
Definition at line 317 of file thread.h. Referenced by threadstate_process_blockingevent(), and threadutil_update_sleeptime_interval(). |
|
thread is unconditionally waiting
Definition at line 320 of file thread.h. Referenced by jlObject_wait4ever(). |
|
thread is waiting, but finite time
Definition at line 323 of file thread.h. Referenced by threadutil_update_sleeptime_interval(), and threadutil_update_wait(). |
|
thread is suspended, can be resumed
Definition at line 326 of file thread.h. Referenced by jlThread_isDaemon(), and jlThread_setDaemon(). |
|
thread is waiting on an interruptable I/O channel in class java.nio.channels.InterruptibleChannel
|
|
thread has been notified
Definition at line 333 of file thread.h. Referenced by threadutil_update_wait(). |
|
thread has been interrupted
Definition at line 336 of file thread.h. Referenced by jlThread_interrupt(), jlThread_isAlive(), jlThread_yield(), and threadutil_update_wait(). |
|
thread threw a The object type is found in pThrowableEvent and is not rnull. Definition at line 339 of file thread.h. Referenced by jlObject_wait4ever(), jlThread_getPriority(), jlThread_interrupted(), jlThread_isAlive(), jlThread_isDaemon(), jlThread_setDaemon(), jlThread_setPriority(), jlThread_start(), objectutil_synchronize(), opcode_run(), thread_exception_setup(), and threadutil_update_wait(). |
|
thread threw a The object type is found in pThrowableEvent and is not rnull. Definition at line 349 of file thread.h. Referenced by opcode_run(), and thread_exception_setup(). |
|
thread threw a The object type is found in pThrowableEvent and is not rnull. Definition at line 359 of file thread.h. Referenced by opcode_run(), and thread_exception_setup(). |
|
A
Instead, it will be handled by the default Definition at line 368 of file thread.h. Referenced by opcode_run(), and thread_exception_setup(). |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Map state numbers to state names.
< Highest possible state number Definition at line 224 of file thread.c. References EXIT_JVM_THREAD, exit_throw_exception(), JVMCFG_FIRST_THREAD, JVMCFG_MAX_THREADS, JVMCLASS_JAVA_LANG_OUTOFMEMORYERROR, pjvm, rtrue, THREAD, rjvm::thread_new_last, and THREAD_STATUS_INUSE. Referenced by opcode_run(). |
|
Load a class onto a thread during JVM initialization.
Allocate a new thread and load a class (array or non-array), prepare to invoke Classes loaded through this function will not be marked as referenced, but will also not be marked for garbage collection, either.
java.lang.Object < Is an interface, not a class.
< References |
|
|
|
Terminate and deallocate a thread that is currently in the DEAD state.
|
|
|
|
Set up JVM thread-relative exception handler-- implements
For internal use only.
int nonlocal_rc = setjmp(*THREAD(thridx).nonlocal_ThrowableEvent);
To get this working, the nonlocal_ThrowableEvent had to be changed to a pointer and a buffer allocated from heap. This probably is due to the Definition at line 1077 of file thread.c. References EXIT_JVM_INTERNAL, exit_throw_exception(), JVMCLASS_JAVA_LANG_INTERNALERROR, THREAD_STATUS_THREW_ERROR, THREAD_STATUS_THREW_EXCEPTION, THREAD_STATUS_THREW_THROWABLE, and THREAD_STATUS_THREW_UNCAUGHT. Referenced by opcode_run(). |
|
Global handler setup for JVM thread errors and exceptions-- implements
java.lang.Exception (but NOT a java.lang.Error) . The object type is found in pThrowableEvent and is not rnull.
< thread threw a
< thread threw a
< A Definition at line 1130 of file thread.c. Referenced by jlObject_wait4ever(), jlThread_getPriority(), jlThread_interrupted(), jlThread_isAlive(), jlThread_isDaemon(), jlThread_setDaemon(), jlThread_setPriority(), jlThread_start(), objectutil_synchronize(), and opcode_run(). |
|
Request the NEW thread state. The NEW state starts the whole state machine for a thread. < Next requested thread state. Definition at line 556 of file threadstate.c. References rtrue, STATE_END, and STATE_REQUEST. |
|
Request the START state. The START state can only be entered from NEW. < This current thread state. < Next requested thread state. Definition at line 619 of file threadstate.c. References STATE_END, STATE_PROCESS, and threadstate_request_runnable(). |
|
Request the RUNNABLE state. The RUNNABLE state can be entered from START, RUNNING, UNBLOCKED, or ACQUIRE. < This current thread state. < This current thread state. < This current thread state. < This current thread state. < Next requested thread state. Definition at line 688 of file threadstate.c. References rtrue, STATE_END, STATE_REQUEST, THIS_STATE, and THREAD_STATE_RUNNABLE. Referenced by jlThread_currentThread(), jlThread_sleep(), threadstate_process_synchronized(), and threadstate_request_start(). |
|
Request the RUNNING state. The RUNNING state can only be entered from RUNNABLE. The JVM inner execution loop is called from threadstate_process_running(), causing any thread in the RUNNING state to normally keep executing its code from where it left off last time. < This current thread state. < Next requested thread state. Definition at line 774 of file threadstate.c. References STATE_REQUEST, THIS_STATE, and THREAD_STATE_RUNNING. |
|
Request the COMPLETE state. The COMPLETE state can be entered from NEW or RUNNING or BADLOGIC. When entered from NEW, it is a so-called "stillborn" thread that was created but never used. When entered from BADLOGIC, java.lang.Thread.destroy() or java.lang.Thread.stop() was invoked, both of which are dangerous, deprecated methods. < This current thread state. < This current thread state. < This current thread state. < Next requested thread state. Definition at line 857 of file threadstate.c. Referenced by opcode_run(). |
|
Request the BLOCKINGEVENT state. The BLOCKINGEVENT state can be entered from the RUNNING or BADLOGIC states. This can be caused by java.lang.Thread.sleep() and java.lang.Thread.join() and interruptible I/O operations. Also, deprecated java.lang.Thread.suspend() can go through BADLOGIC to get here. < This current thread state. < This current thread state. < Next requested thread state. Definition at line 938 of file threadstate.c. Referenced by jlThread_isDaemon(), and jlThread_setDaemon(). |
|
Request the BLOCKED state. The BLOCKED state can only be entered from BLOCKINGEVENT. < This current thread state. < Next requested thread state. Definition at line 1009 of file threadstate.c. Referenced by jlThread_isDaemon(). |
|
Request the UNBLOCKED state. The UNBLOCKED state can only be entered from BLOCKED. < This current thread state. < Next requested thread state. Definition at line 1076 of file threadstate.c. Referenced by jlThread_isDaemon(). |
|
Request the SYNCHRONIZED state. The SYNCHRONIZED state can only be entered from RUNNING. < This current thread state. < Next requested thread state. Definition at line 1144 of file threadstate.c. References threadstate_request_acquire(). Referenced by objectutil_synchronize(). |
|
Request the RELEASE state. The RELEASE state can only be entered from RUNNING. < This current thread state. < Next requested thread state. Definition at line 1212 of file threadstate.c. References rtrue, STATE_END, STATE_REQUEST, THIS_STATE, and THREAD_STATE_COMPLETE. |
|
Request the WAIT state. The WAIT state can only be entered from RELEASE. < This current thread state. < Next requested thread state. Definition at line 1310 of file threadstate.c. |
|
Request the NOTIFY state. The NOTIFY state can only be entered from WAIT. < This current thread state. < Next requested thread state. Definition at line 1379 of file threadstate.c. Referenced by threadutil_update_wait(). |
|
Request the LOCK state. The LOCK state can be entered from SYNCHRONIZED or NOTIFY. < This current thread state. < This current thread state. < Next requested thread state. Definition at line 1448 of file threadstate.c. |
|
Request the ACQUIRE state. The ACQUIRE state can only be entered from LOCK. < This current thread state. < Next requested thread state. Definition at line 1548 of file threadstate.c. Referenced by threadstate_request_synchronized(). |
|
Request the DEAD state. The DEAD state can only be entered from COMPLETE. < This current thread state. < Next requested thread state. Definition at line 1617 of file threadstate.c. |
|
Request the BADLOGIC state. The BADLOGIC state can be entered from ANY state. It is primarily a diagnostic state, but may be used to gracefully handle java.lang.Thread.destroy() and java.lang.Thread.stop() and java.lang.Thread.suspend() and java.lang.Thread.resume(). < Next requested thread state. Definition at line 1699 of file threadstate.c. Referenced by jlThread_currentThread(), and jlThread_setDaemon(). |
|
Activate the NEW thread state for a new thread. < Next requested thread state. < Previous actual thread state. < This current thread state. < This current thread state. < Next requested thread state. < This current thread state. Definition at line 570 of file threadstate.c. |
|
Activate the START thread state of a thread known to be coming from a valid previous state. < Next requested thread state. < Previous actual thread state. < This current thread state. < This current thread state. < Next requested thread state. < This current thread state. Definition at line 636 of file threadstate.c. References rtrue, STATE_END, STATE_REQUEST, THIS_STATE, THREAD_STATE_ACQUIRE, THREAD_STATE_RUNNING, THREAD_STATE_START, and THREAD_STATE_UNBLOCKED. |
|
Activate the RUNNABLE thread state of a thread known to be coming from a valid previous state. < Next requested thread state. < Previous actual thread state. < This current thread state. < This current thread state. < Next requested thread state. < This current thread state. Definition at line 718 of file threadstate.c. |
|
Activate the RUNNING thread state of a thread known to be coming from a valid previous state. < Next requested thread state. < Previous actual thread state. < This current thread state. < This current thread state. < Next requested thread state. < This current thread state. Definition at line 792 of file threadstate.c. |
|
Activate the COMPLETE thread state of a thread known to be coming from a valid previous state. < Next requested thread state. < Previous actual thread state. < This current thread state. < This current thread state. < Next requested thread state. < This current thread state. Definition at line 884 of file threadstate.c. |
|
Activate the BLOCKINGEVENT thread state of a thread known to be coming from a valid previous state. < Next requested thread state. < Previous actual thread state. < This current thread state. < This current thread state. < Next requested thread state. < This current thread state. Definition at line 960 of file threadstate.c. References rtrue, STATE_ACTIVATE, and STATE_END. Referenced by jlThread_isDaemon(). |
|
Activate the BLOCKED thread state of a thread known to be coming from a valid previous state. < Next requested thread state. < Previous actual thread state. < This current thread state. < This current thread state. < Next requested thread state. < This current thread state. Definition at line 1027 of file threadstate.c. References rtrue, STATE_ACTIVATE, and STATE_END. Referenced by jlThread_isDaemon(). |
|
Activate the UNBLOCKED thread state of a thread known to be coming from a valid previous state. < Next requested thread state. < Previous actual thread state. < This current thread state. < This current thread state. < Next requested thread state. < This current thread state. Definition at line 1094 of file threadstate.c. References rtrue, STATE_END, STATE_REQUEST, THIS_STATE, THREAD_STATE_NOTIFY, and THREAD_STATE_SYNCHRONIZED. |
|
Activate the SYNCHRONIZED thread state of a thread known to be coming from a valid previous state. < Next requested thread state. < Previous actual thread state. < This current thread state. < This current thread state. < Next requested thread state. < This current thread state. Definition at line 1162 of file threadstate.c. |
|
Activate the RELEASE thread state of a thread known to be coming from a valid previous state. < Next requested thread state. < Previous actual thread state. < This current thread state. < This current thread state. < Next requested thread state. < This current thread state. Definition at line 1230 of file threadstate.c. |
|
Activate the WAIT thread state of a thread known to be coming from a valid previous state. < Next requested thread state. < Previous actual thread state. < This current thread state. < This current thread state. < Next requested thread state. < This current thread state. Definition at line 1328 of file threadstate.c. |
|
Activate the NOTIFY thread state of a thread known to be coming from a valid previous state. < Next requested thread state. < Previous actual thread state. < This current thread state. < This current thread state. < Next requested thread state. < This current thread state. Definition at line 1397 of file threadstate.c. |
|
Activate the LOCK thread state of a thread known to be coming from a valid previous state. < Next requested thread state. < Previous actual thread state. < This current thread state. < This current thread state. < Next requested thread state. < This current thread state. Definition at line 1470 of file threadstate.c. |
|
Activate the ACQUIRE thread state of a thread known to be coming from a valid previous state. < Next requested thread state. < Previous actual thread state. < This current thread state. < This current thread state. < Next requested thread state. < This current thread state. Definition at line 1566 of file threadstate.c. |
|
Activate the DEAD thread state of a thread known to be coming from a valid previous state. < Next requested thread state. < Previous actual thread state. < This current thread state. < This current thread state. < Next requested thread state. < This current thread state. Definition at line 1635 of file threadstate.c. |
|
Activate the BADLOGIC thread state of a thread known to be coming from a valid previous state. < Next requested thread state. < Previous actual thread state. < This current thread state. < This current thread state. < Next requested thread state. < This current thread state. Definition at line 1714 of file threadstate.c. Referenced by jlThread_setDaemon(). |
|
Process the NEW thread state. The NEW state idles until the START state is requested. < This current thread state. Definition at line 601 of file threadstate.c. References rtrue, STATE_ACTIVATE, and STATE_END. |
|
Process the START thread state. THIS IS A TRANSIENT STATE! A state change from START to RUNNABLE is requested here. < This current thread state. Definition at line 667 of file threadstate.c. References rtrue, STATE_END, and STATE_PROCESS. |
|
Process the RUNNABLE thread state. Always try to keep RUNNABLE thread in the RUNNING state. Although not formally a transient state, RUNNABLE indicates that a thread is potentially one that could be RUNNING, thus the attempt to keep it there. < This current thread state. Definition at line 751 of file threadstate.c. References rtrue, STATE_ACTIVATE, and STATE_END. |
|
Process the RUNNING thread state. Run the next virtual instruction engine on the current thread from where it left off last time.
< Access structures of the thread now running in the JVM. Definition at line 827 of file threadstate.c. References rtrue, STATE_END, STATE_REQUEST, THIS_STATE, and THREAD_STATE_BLOCKINGEVENT. |
|
Process the COMPLETE thread state. THIS IS A TRANSIENT STATE! A state change from COMPLETE to DEAD is requested here. < This current thread state. Definition at line 915 of file threadstate.c. |
|
Process the BLOCKINGEVENT thread state. THIS IS A TRANSIENT STATE! A state change from BLOCKINGEVENT to BLOCKED is requested here. < This current thread state. Definition at line 991 of file threadstate.c. References rfalse, THREAD, THREAD_STATUS_JOIN4EVER, and THREAD_STATUS_JOINTIMED. Referenced by jlThread_isDaemon(). |
|
Process the BLOCKED thread state. The BLOCKED state idles until the UNBLOCKED state is requsted by threadutil_update_blockingevents(). < This current thread state. Definition at line 1058 of file threadstate.c. References rtrue, STATE_END, STATE_REQUEST, THIS_STATE, and THREAD_STATE_WAIT. Referenced by jlThread_isDaemon(). |
|
Process the UNBLOCKED thread state. THIS IS A TRANSIENT STATE! A state change from UNBLOCKED to RUNNABLE is requested here. < This current thread state. Definition at line 1125 of file threadstate.c. References STATE_PROCESS. |
|
Process the SYNCHRONIZED thread state. THIS IS A TRANSIENT STATE! A state change from SYNCHRONIZED to LOCK is requested here. < This current thread state. Definition at line 1193 of file threadstate.c. References STATE_END, STATE_PROCESS, and threadstate_request_runnable(). |
|
Process the RELEASE thread state. THIS IS A TRANSIENT STATE! A state change from RELEASE to WAIT is requested here. However, this will only occur if this thread holds the lock on the rthread.locktarget object. < This current thread state. < thread has unconditionally joined another < thread has joined another, but is waiting for a finite time Definition at line 1265 of file threadstate.c. References rtrue, STATE_END, and STATE_REQUEST. |
|
Process the WAIT thread state. The WAIT state idles until the NOTIFY state is requsted by threadutil_update_wait(). < This current thread state. Definition at line 1360 of file threadstate.c. |
|
Process the NOTIFY thread state. THIS IS A TRANSIENT STATE! A state change from NOTIFY to LOCK is requested here. < This current thread state. Definition at line 1429 of file threadstate.c. |
|
Process the LOCK thread state. THIS IS THE PLACE WHERE THREADS COMPETE FOR AN OBJECT MONITORY LOCK. If a thread is able to successfully run objectutil_synchronize(), then it acquires the MLOCK for that object and moves from the LOCK state forward to the ACQUIRE state. The LOCK state idles until the ACQUIRE state is requsted by threadutil_update_lock(). < This current thread state. Definition at line 1508 of file threadstate.c. |
|
Process the ACQUIRE thread state. THIS IS A TRANSIENT STATE! A state change from ACQUIRE to RUNABLE is requested here. < This current thread state. Definition at line 1598 of file threadstate.c. |
|
Process the DEAD thread state. Bogus, yet true: THIS IS A TRANSIENT STATE! the usual message about this state applies, yet the target state is the "not used" condition, so it may also be considered inapplicable. Here 'tis: THIS IS A TRANSIENT STATE! A state change from DEAD to "not used" is requested here. So how is this statement true? Because thread_die() is called once the thread enters this condition, removing it from the array of active thread table entries. < This current thread state. Definition at line 1676 of file threadstate.c. |
|
Process the BADLOGIC thread state. The BADLOGIC state idles until another state is requested. An "Idle forever" error message might be printed by code that invoked this state. If desired, this state can be moved forward to COMPLETE or BLOCKINGEVENT. Part of the request logic for these states is to permit entrance from the BADLOGIC state. < This current thread state. Definition at line 1750 of file threadstate.c. |
|
Update the interval timer for this thread from This function is designed to be invoked from the timeslice interrupt handler and only from thence. It DOES NOT handle (millisec, nanosec) resolution, only millisecond resolution. Parameters: rvoid
< thread is sleeping < thread has joined another, but is waiting for a finite time < thread is waiting, but finite time Definition at line 84 of file threadutil.c. References jvm_thread_index_null, JVMCFG_MAX_THREADS, pjvm, rjvm::sleeplock, THREAD, THREAD_STATUS_INUSE, THREAD_STATUS_JOINTIMED, THREAD_STATUS_SLEEP, and THREAD_STATUS_WAITTIMED. Referenced by timeslice_tick(). |
|
Complete the UNtimed Thread.join() request and allow threads that have joined this one to resume execution. This function is typically called when a thread enters the COMPLETE state after finishing its JVM execution. Review state of thread table, looking for the following conditions. For those that meet them, move thread out of given state and forward to next state. Three functions are used, depending on the current state, threadutil_update_blockingevent() and threadutil_update_wait() and threadutil_update_lock():
Condition: Current state: Next state: threadutil_update_YYY: ---------- -------------- ----------- ---------------------- Thread.join() COMPLETE N/C _blockingevents() (forever, where current thread is COMPLETE, and target thread is BLOCKED, and is moved to UNBLOCKED) Thread.join(n) COMPLETE N/C _blockingevents() (timed, where n has expired on current thread or it is COMPLETE, and target thread is BLOCKED, and is moved to UNBLOCKED) Thread.sleep(n) BLOCKED UNBLOCKED _blockingevents() (n has expired on current thread) Interruptible I/O BLOCKED UNBLOCKED _blockingevents() from class java.nio.channels .InterruptibleChannel Object.wait() WAIT NOTIFY _wait() (forever on current thread, where target object lock was released) Object.wait(n) WAIT NOTIFY _wait() (timed, where @c @b n has expired on current thread or target object lock was released) One of: LOCK ACQUIRE _lock() Object.notify() Object.notifyAll() Thread.interrupt() synchronized(Object) ... put thread into LOCK state. Now it will negotiate to ACQUIRE its object's monitor lock. Thread.suspend() ANY BLOCKED threadutil_suspend() Thread.resume() BLOCKED UNBLOCKED threadutil_resume() moves a Thread.suspend() thread forward to UNBLOCKED With the exception of threadutil_suspend() and threadutil_resume(), these functions is designed to be invoked from the JVM outer loop. CAVEAT EMPTOR: Those two functions are deprecated. Use at your own risk!
< thread is sleeping < thread has been interrupted < thread has been interrupted
< thread threw a
Check if Thread.interrupt() was thrown against the interruptible I/O operation on this thread.
< thread is waiting on an interruptable I/O channel in class java.nio.channels.InterruptibleChannel < thread has been interrupted
< thread threw a < thread has unconditionally joined another < thread has unconditionally joined another < thread has been interrupted < thread has been interrupted
< thread threw a < thread has joined another, but is waiting for a finite time < thread has joined another, but is waiting for a finite time < thread has been interrupted < thread has been interrupted
< thread threw a Definition at line 221 of file threadutil.c. |
|
< This slot contains a thread < thread is unconditionally waiting < thread has been interrupted < thread has been interrupted
< thread threw a < thread is unconditionally waiting < thread has been notified < thread has been notified < thread is unconditionally waiting < thread is waiting, but finite time < thread is waiting, but finite time < thread has been interrupted < thread has been interrupted
< thread threw a < thread is waiting, but finite time < thread has been notified < thread has been notified < thread is waiting, but finite time Definition at line 444 of file threadutil.c. References JVMCLASS_JAVA_LANG_INTERRUPTEDEXCEPTION, THREAD, THREAD_STATUS_INTERRUPTED, THREAD_STATUS_NOTIFIED, THREAD_STATUS_THREW_EXCEPTION, THREAD_STATUS_WAITTIMED, threadstate_request_notify(), and timeslice_get_thread_sleeptime(). |
|
< This slot contains a thread < Object monitor locked by mlock_thridx < thread is unconditionally waiting Definition at line 575 of file threadutil.c. |
|
Examine an object to see if a thread owns its monitor lock.
< 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 a thread < Null thread (only 1 exists in normal use, any else besides the JVMCFG_NULL_THREAD is a thread slot that is being initialized.) < Object monitor locked by mlock_thridx < thread is unconditionally waiting < thread is waiting, but finite time Definition at line 640 of file threadutil.c. Referenced by jlThread_interrupted(). |
|
|