|
" 2013 FRC Java API " |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.sun.squawk.VMThread
public final class VMThread
The Squawk implementation of threads.
Monitor
Field Summary | |
---|---|
static int |
MAX_PRIORITY
The maximum priority that a user thread can have. |
static int |
MAX_SYS_PRIORITY
The maximum priority that a system thread can have. |
static int |
MIN_PRIORITY
The minimum priority that a thread can have. |
static int |
NORM_PRIORITY
The default priority that is assigned to a thread. |
Constructor Summary | |
---|---|
VMThread(Thread apiThread,
String name)
Allocates a new VMThread object to support a given API Thread instance. |
Method Summary | |
---|---|
static int |
activeCount()
Returns the current number of active threads in the VM. |
static VMThread |
asVMThread(Thread thread)
|
void |
clearBreakpoint()
Clears the object used to report a breakpoint hit. |
void |
clearStep()
Removes the object (if any) that is keeping this thread in single stepping mode. |
static VMThread |
currentThread()
Returns a reference to the currently executing thread object. |
Thread |
getAPIThread()
|
static int |
getContendedMontorEnterCount()
Return the number of times that a thread was blocked trying to synchronize on an object. |
int |
getDebuggerSuspendCount()
Gets the value of the debugger suspension counter for this thread. |
int |
getErrno()
Return the system errno value from the last time a native function was called. |
ExecutionPoint |
getEventExecutionPoint()
Gets the method and frame context of this thread at which a debugger event occurred. |
int |
getInternalStatus()
Gets the combined values for state and queue . |
Isolate |
getIsolate()
Gets the isolate of the thread. |
static int |
getMaxStackSize()
Return size of the largest stack ever allocated, in words. |
static int |
getMonitorsAllocatedCount()
Return the number of monitors allocated. |
String |
getName()
Gets the name of this thread. |
int |
getPriority()
Returns this thread's priority. |
static Thread[] |
getRunnableThreads()
|
static int |
getStacksAllocatedCount()
Return the number of stacks allocated. |
Debugger.SingleStep |
getStep()
|
static SystemEvents |
getSystemEvents()
Handler for OS events... |
int |
getThreadNumber()
Gets the number of this thread which is only guaranteed to be unique within this thread's isolate. |
static int |
getThreadsAllocatedCount()
Return the number of Thread objects allocated during the lifetime of this JVM. |
static int |
getThreadSwitchCount()
Return count of thread context switching. |
static long |
getTotalWaitTime()
|
void |
interrupt()
Interrupts this thread. |
boolean |
isAlive()
Tests if this thread is alive. |
boolean |
isDaemon()
Gets the daemon state of the thread. |
boolean |
isServiceThread()
Determines if this thread is the service thread. |
void |
join()
Waits for this thread to die. |
static void |
monitorNotify(Object object,
boolean notifyAll)
Notify an object. |
static void |
monitorWait(Object object,
long delta)
Wait for an object to be notified. |
void |
printStackTrace(PrintStream stream)
Print a stack trace for this thread. |
void |
printState(PrintStream out)
Print thread state one one line. |
int |
resumeForDebugger(boolean forDetach)
Decreases the suspension count of this thread. |
void |
setDaemon(boolean value)
Sets the daemon state of the thread. |
void |
setName(String name)
Sets the name of this thread. |
void |
setPriority(int newPriority)
Changes the priority of this thread. |
void |
setStep(Debugger.SingleStep step)
Sets the object that will put this thread into single stepping mode the next time it is scheduled to run. |
void |
setSystemPriority(int newPriority)
Changes the priority of this thread. |
static void |
signalOSEvent(int event)
Restart a thread blocked on an event. |
static void |
sleep(long millis)
Causes the currently executing thread to sleep (temporarily cease execution) for the specified number of milliseconds. |
void |
start()
Causes this thread to begin execution; the Java Virtual Machine calls the run method of this thread. |
int |
suspendForDebugger()
Increases the suspension count of this thread. |
String |
toString()
Returns a string representation of this thread, including a unique number that identifies the thread and the thread's priority. |
static void |
waitForOSEvent(int event)
Block a thread waiting for an event. |
static void |
yield()
Causes the currently executing thread object to temporarily pause and allow other threads to execute. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final int MIN_PRIORITY
public static final int NORM_PRIORITY
public static final int MAX_PRIORITY
public static final int MAX_SYS_PRIORITY
Constructor Detail |
---|
public VMThread(Thread apiThread, String name)
VMThread
object to support a given API Thread instance.
This constructor should only be called from a java.lang.Thread constructor.
apiThread
- the API thread instance supported by this VM threadname
- the thread name, or null. If null, thread name generated from threadNumber.Method Detail |
---|
public static int getThreadsAllocatedCount()
public static int getContendedMontorEnterCount()
public static int getMonitorsAllocatedCount()
public static int getThreadSwitchCount()
public static VMThread currentThread()
public void setDaemon(boolean value)
value
- if true, set thread as a daemonpublic boolean isDaemon()
public static void sleep(long millis) throws InterruptedException
millis
- the length of time to sleep in milliseconds.
InterruptedException
- if another thread has interrupted
the current thread. The interrupted status of the
current thread is cleared when this exception is thrown.Object.notify()
public static void yield()
public void start()
run
method of this thread.
The result is that two threads are running concurrently: the
current thread (which returns from the call to the
start
method) and the other thread (which executes its
run
method).
IllegalThreadStateException
- if the thread was already started.Thread.run()
public final boolean isAlive()
true
if this thread is alive;
false
otherwise.public final void setPriority(int newPriority)
newPriority
- priority to set this thread to
IllegalArgumentException
- If the priority is not in the
range MIN_PRIORITY
to
MAX_PRIORITY
.getPriority()
,
Thread.getPriority()
,
Thread.MAX_PRIORITY
,
Thread.MIN_PRIORITY
public final void setSystemPriority(int newPriority)
newPriority
- priority to set this thread to
IllegalArgumentException
- If the priority is not in the
range MIN_PRIORITY
to
MAX_SYS_PRIORITY
.getPriority()
,
Thread.getPriority()
,
Thread.MAX_PRIORITY
,
Thread.MIN_PRIORITY
public final int getPriority()
setPriority(int)
,
Thread.setPriority(int)
public static int activeCount()
public final void join() throws InterruptedException
InterruptedException
- if another thread has interrupted
the current thread. The interrupted status of the
current thread is cleared when this exception is thrown.public final String getName()
setName(java.lang.String)
has never been called for this
thread, the return value will be of the from "Thread-
public final void setName(String name)
name
- the new name for this threadpublic String toString()
toString
in class Object
public static SystemEvents getSystemEvents()
public final int getDebuggerSuspendCount()
public final int suspendForDebugger()
public final int resumeForDebugger(boolean forDetach)
forDetach
- if true, the count is set to 0
public ExecutionPoint getEventExecutionPoint()
public final int getInternalStatus()
state
and queue
.
public final Debugger.SingleStep getStep()
public final void setStep(Debugger.SingleStep step)
step
- the details of the requested steppublic final void clearStep()
public void clearBreakpoint()
public Isolate getIsolate()
public Thread getAPIThread()
public static VMThread asVMThread(Thread thread)
public boolean isServiceThread()
public final int getThreadNumber()
public static int getStacksAllocatedCount()
public static int getMaxStackSize()
public static long getTotalWaitTime()
public void printState(PrintStream out)
out
unless an error occurs while printing on that stream,
such as a null stream, or IO error on the stream.
If a printing error occurs, this falls back on printing via VM.print(), etc.
out
- the stream to print on.public void printStackTrace(PrintStream stream)
Will print on the stream out
unless an error occurs while printing on that stream,
such as a null stream, or IO error on the stream.
If a printing error occurs, this falls back on printing via VM.print(), etc.
stream
- public static void waitForOSEvent(int event)
event
- the event number to wait forpublic static void signalOSEvent(int event)
event
- the event number to unblockpublic int getErrno()
public static void monitorWait(Object object, long delta) throws InterruptedException
object
- the object to wait ondelta
- the timeout period
InterruptedException
- if another thread has interrupted
the current thread. The interrupted status of the
current thread is cleared when this exception is thrown.public static void monitorNotify(Object object, boolean notifyAll)
object
- the object be notifiednotifyAll
- flag to notify all waiting threadspublic void interrupt()
This method does nothing if the current thread is interrupting itself.
If this thread is blocked in an invocation of the Object.wait()
,
Object.wait(long)
, or Object.wait(long, int)
methods of the
class, or of the Thread.join()
, Thread#join(long)
,
Thread#join(long, int)
, Thread.sleep(long)
, or
Thread#sleep(long, int)
methods of this class, then its interrupt
status will be cleared and it will receive an InterruptedException
.
If none of the previous conditions hold then this thread's interrupt status will be set.
public static Thread[] getRunnableThreads()
|
" 2013 FRC Java API " |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |