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

threadstate.c File Reference


Detailed Description

Validate and perform state transitions, and process each state of the JVM thread state machin.

This implementation of the JVM state machine using both stable and transient states. The thread system operates as a state machine based on the JVM spec requirements. The states for this implementation are shown below. Those marked (+) are transient states and will move forward to the next stable state as soon as possible:

The state transitions are:

The first line (line a) is the main flow of control.

(line b) depend on various programmatic events such as java.lang.Thread.yield() invocation and normal JVM thread arbitration.

(line c) involves scheduled programmatic events like java.lang.Thread.sleep() and java.lang.Thread.join(), java.lang.Thread.interrupt() events (line c), or interruptible I/O operations.

(line d) depicts synchronized() requests (line d)

(line e) involives java.lang.Object.wait() requests (after object lock acquired) via java.lang.Object.notify() or java.lang.Object.notifyAll() or java.lang.Thread.interrupt() events.

(line f), shows the so-called "stillborn" thread that dies before it has a chance to java.lang.Thread.start().

(lines g, h, i), demonstrates how this implementation gracefully minimizes the damage of the deprecated java.lang.Thread.destroy(), java.lang.Thread.stop(), java.lang.Thread.suspend(), and java.lang.Thread.resume().

(line j), shows a state that has been added to handle errors, typically from development and testing. This provides a valid state transition that may be done programmatically to sideline any desired thread.

Notice that there are more states here than in the classic model for the JVM. Part of the reason for this is that a finer granularity of control provides the state model with an insertion point for diagnostics of the state model, especially in the transient states (namely START, RELEASE, SYNCHRONIZED, NOTIFY, ACQUIRE, and COMPLETE). This is complementary to the definition of each state. The implementation of this model includes three groups of functions named after each of three phases of state change and processing and after each state name:

These three stages in the JVM outer loop provide immediate diagnostics in case of problems with state transitions, which is, of course, useful during development, but can also provide safeguards during normal runtime. The processing overhead is negligible since it is in the outer loop. All groups of routines return a boolean describing whether or not the activities for that phase of that state succeeded. For example, thread_request_runnable() attempts to take a thread from its current state into THREAD_STATE_RUNNABLE. If it succeeds, it returns rtrue, otherwise rfalse.

All transition requests work exactly the same way. The actual performance of that change may require doing some work, depending on the particular state being requested, but most require only a simple state transition. For example, the beginning of the world is threadstate_request_start(), which is equivalent to the java.lang.Thread method java.lang.Thread.start(). At various times during development, it had some work to perform as the thread state model was integrated into the JVM, such as loading the JVM's PC with the entry point of the correct method. But in the case of threadstate_request_unblocked(), a state transition will also be requested since it is a transitory state in addition to any other work it may perform.

All logic for each state change is found within its respective threadstate_[request| activate process]_XXX() function below.

Attention:
: Only a NEW thread may be moved into the START state. Only an THREAD_STATUS_EMPTY thread may be moved into THREAD_STATUS_INUSE status and hence the NEW state. Only the JVMCFG_NULL_THREAD may be permanently marked as being THREAD_STATUS_NULL. These two conditions must never be manipulated by thread_new() and thread_die().

Control

$URL: https://svn.apache.org/path/name/threadstate.c $ $Id: threadstate.c 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 threadstate.c.

#include "arch.h"
#include "jvmcfg.h"
#include "classfile.h"
#include "jvm.h"
#include "opcode.h"

Go to the source code of this file.

State phase macros

Macros to support the three phases of moving from one thread state to another.

See section on the JVM thread model state machine for an explanation as to why these functions exist. Concerning how they operate, an example of their usage in the START state functions will provide clear guidance of how to use them generally. The first state transition request is always from NEW to START. The macro expansion of the macros inside of threadstate_request_start() demonstrate syntax for how this accomplihed. Following that is the syntax for threadstate_activate_start() and threadstate_process_start(). The declaration of these three functions follows later. For good form when using these functions with these state phase macros, be sure to place the whole of the second parameter expression of STATE_REQUEST() in (parentheses).

Transition is shown from NEW to START to show a more normal example than from "not in use" to NEW.

The expansion of the macros inside of the three START functions produces the following code:

   rboolean threadstate_request_start(jvm_thread_index thridx)
   {
       if (THREAD_STATE_NEW == THREAD(thridx).this_state)
       {
           THREAD(thridx).next_state = THREAD_STATE_START;
   
           ** use (rtrue) if nothing else needed **
           return((rtrue) ? rtrue : rfalse);
       }
       else
       {
           return(rfalse);
       };
   }
   
   rboolean threadstate_activate_start(jvm_thread_index thridx)
   {
       if (THREAD_STATE_START == THREAD(thridx).next_state)
       {
         ** Record previous state when changing to next one **
           THREAD(thridx).prev_state = THREAD(thridx).this_state;
           THREAD(thridx).this_state = THREAD(thridx).next_state;
       }
       if (THREAD_STATE_START == THREAD(thridx).this_state)
       {
           return((rtrue) ? rtrue : rfalse);
       }
       else
       {
           return(rfalse);
       };
   }
   
   rboolean threadstate_process_start(jvm_thread_index thridx)
   {
       if (THREAD_STATE_START == THREAD(thridx).this_state)
       {
    
          ** ... Process activities for this thread state here ... **
   
          ** use (rtrue) if nothing else needed **
          return((threadstate_request_runnable(thridx)) ? rtrue:rfalse);
       }
       else
       {
           return(rfalse);
       };
  }
  
   


#define STATE_ACTIVATE(upper)
 Activate a state change that was validated by STATE_REQUEST().
#define STATE_END(expr)
 Terminate the code fragment initiated by STATE_REQUEST() or STATE_ACTIVATE() or STATE_PROCESS().
#define STATE_PROCESS(upper)
 Process a state change that was activated by STATE_ACTIVATE().
#define STATE_REQUEST(upper, unique_state_test)
 Request a state change from this state to another state.

JVM thread model state machine

Implement the JVM state machine using both stable and transient states.

See tables above for full description.

Todo:
Need to find a way (per spec section 5.3.5) to throw a java.lang.LinkageError and/or java.lang.ClassFormatError for bad classfile representations. Also major/minor versions mismatch should throw java/class/UnsupportedClassVersion error.
Parameters:
thridx thread index of thread whose state is to be changed.
Returns:
rtrue if all activities were successful, else rfalse.


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.

Functions

static void threadstate_c_dummy (void)

Variables

static char * threadstate_c_copyright = "\0" "$URL: https://svn.apache.org/path/name/threadstate.c $ $Id: threadstate.c 0 09/28/2005 dlydick $" " " "Copyright 2005 The Apache Software Foundation or its licensors, as applicable."


Define Documentation

#define STATE_REQUEST upper,
unique_state_test   ) 
 

Value:

if (unique_state_test)                                    \
    {                                                         \
        NEXT_STATE(thridx) = THREAD_STATE_##upper
Request a state change from this state to another state.

Parameters:
upper New state name in UPPER CASE (for macro expansion purposes)
unique_state_test BE SURE to put put this parameter in (parentheses) for proper macro expansion! Permit state change into requested state only if this expression evaluates to rtrue, which may be explicitly stated if this state change is unconditional.
Returns:
rtrue if state change was permitted, otherwise rfalse.

Definition at line 434 of file threadstate.c.

Referenced by threadstate_activate_start(), threadstate_activate_unblocked(), threadstate_process_blocked(), threadstate_process_release(), threadstate_process_running(), threadstate_request_new(), threadstate_request_release(), threadstate_request_runnable(), and threadstate_request_running().

#define STATE_ACTIVATE upper   ) 
 

Value:

if (THREAD_STATE_##upper == NEXT_STATE(thridx))           \
    {                                                         \
        /* Record previous state when changing to next one */ \
        PREV_STATE(thridx) = THIS_STATE(thridx);              \
        THIS_STATE(thridx) = NEXT_STATE(thridx);              \
    }                                                         \
                                                              \
    if (THREAD_STATE_##upper == THIS_STATE(thridx))           \
    {
Activate a state change that was validated by STATE_REQUEST().

Parameters:
upper New state name in UPPER CASE (for macro expansion purposes)
Returns:
rtrue if state change was permitted, otherwise rfalse.

Definition at line 456 of file threadstate.c.

Referenced by threadstate_activate_blocked(), threadstate_activate_blockingevent(), threadstate_process_new(), and threadstate_process_runnable().

#define STATE_PROCESS upper   ) 
 

Value:

if (THREAD_STATE_##upper == THIS_STATE(thridx))           \
    {
Process a state change that was activated by STATE_ACTIVATE().

Parameters:
upper New state name in UPPER CASE (for macro expansion purposes)
Returns:
rtrue if state change was permitted, otherwise rfalse.

Definition at line 484 of file threadstate.c.

Referenced by threadstate_process_start(), threadstate_process_synchronized(), threadstate_process_unblocked(), and threadstate_request_start().

#define STATE_END expr   ) 
 

Value:

/* use (rtrue) if nothing else needed */              \
        return((expr) ? rtrue : rfalse);                      \
    }                                                         \
    else                                                      \
    {                                                         \
        return(rfalse);                                       \
    }
Terminate the code fragment initiated by STATE_REQUEST() or STATE_ACTIVATE() or STATE_PROCESS().

In between the STATE_REQUEST() and STATE_ACTIVATE() and STATE_PROCESS() macro instance and this macro, any phase-specific, state-specific code may be inserted. Although most states do not do so, pay particular attention to those that do, also any comments that may be present in lieu of code.

Definition at line 509 of file threadstate.c.

Referenced by threadstate_activate_blocked(), threadstate_activate_blockingevent(), threadstate_activate_start(), threadstate_activate_unblocked(), threadstate_process_blocked(), threadstate_process_new(), threadstate_process_release(), threadstate_process_runnable(), threadstate_process_running(), threadstate_process_start(), threadstate_process_synchronized(), threadstate_request_new(), threadstate_request_release(), threadstate_request_runnable(), and threadstate_request_start().


Function Documentation

static void threadstate_c_dummy void   )  [static]
 

Definition at line 320 of file threadstate.c.

rboolean threadstate_request_new jvm_thread_index  thridx  ) 
 

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.

rboolean threadstate_activate_new jvm_thread_index  thridx  ) 
 

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.

rboolean threadstate_process_new jvm_thread_index  thridx  ) 
 

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.

rboolean threadstate_request_start jvm_thread_index  thridx  ) 
 

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().

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.

< 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.

rboolean threadstate_process_start jvm_thread_index  thridx  ) 
 

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.

rboolean threadstate_request_runnable jvm_thread_index  thridx  ) 
 

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().

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.

< 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.

rboolean threadstate_process_runnable jvm_thread_index  thridx  ) 
 

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.

rboolean threadstate_request_running jvm_thread_index  thridx  ) 
 

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.

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.

< 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.

rboolean threadstate_process_running jvm_thread_index  thridx  ) 
 

Process the RUNNING thread state.

Run the next virtual instruction engine on the current thread from where it left off last time.

Attention:
Notice that the normal way to invoke opcode_run() is in this location, as driven by the JVM outer loop in jvm_run().
< This current thread state.

< 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.

rboolean threadstate_request_complete jvm_thread_index  thridx  ) 
 

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().

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.

< 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.

rboolean threadstate_process_complete jvm_thread_index  thridx  ) 
 

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.

rboolean threadstate_request_blockingevent jvm_thread_index  thridx  ) 
 

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().

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.

< 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().

rboolean threadstate_process_blockingevent jvm_thread_index  thridx  ) 
 

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().

rboolean threadstate_request_blocked jvm_thread_index  thridx  ) 
 

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().

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.

< 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().

rboolean threadstate_process_blocked jvm_thread_index  thridx  ) 
 

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().

rboolean threadstate_request_unblocked jvm_thread_index  thridx  ) 
 

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().

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.

< 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.

rboolean threadstate_process_unblocked jvm_thread_index  thridx  ) 
 

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.

rboolean threadstate_request_synchronized jvm_thread_index  thridx  ) 
 

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().

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.

< 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.

rboolean threadstate_process_synchronized jvm_thread_index  thridx  ) 
 

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().

rboolean threadstate_request_release jvm_thread_index  thridx  ) 
 

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.

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.

< 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.

rboolean threadstate_process_release jvm_thread_index  thridx  ) 
 

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.

rboolean threadstate_request_wait jvm_thread_index  thridx  ) 
 

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.

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.

< 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.

rboolean threadstate_process_wait jvm_thread_index  thridx  ) 
 

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.

rboolean threadstate_request_notify jvm_thread_index  thridx  ) 
 

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().

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.

< 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.

rboolean threadstate_process_notify jvm_thread_index  thridx  ) 
 

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.

rboolean threadstate_request_lock jvm_thread_index  thridx  ) 
 

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.

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.

< 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.

rboolean threadstate_process_lock jvm_thread_index  thridx  ) 
 

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.

rboolean threadstate_request_acquire jvm_thread_index  thridx  ) 
 

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().

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.

< 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.

rboolean threadstate_process_acquire jvm_thread_index  thridx  ) 
 

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.

rboolean threadstate_request_dead jvm_thread_index  thridx  ) 
 

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.

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.

< 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.

rboolean threadstate_process_dead jvm_thread_index  thridx  ) 
 

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.

rboolean threadstate_request_badlogic jvm_thread_index  thridx  ) 
 

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().

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.

< 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().

rboolean threadstate_process_badlogic jvm_thread_index  thridx  ) 
 

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.


Variable Documentation

char* threadstate_c_copyright = "\0" "$URL: https://svn.apache.org/path/name/threadstate.c $ $Id: threadstate.c 0 09/28/2005 dlydick $" " " "Copyright 2005 The Apache Software Foundation or its licensors, as applicable." [static]
 

Definition at line 320 of file threadstate.c.


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