关于java中thread类_java中Thread类有哪些主要成员变量

展开全部

class Thread implements Runnable {

/* Make sure registerNatives is the first thing  does. */

private static native void registerNatives();

static {

registerNatives();

}

private char    name[];

private int         priority;

private Thread    threadQ;

private long    eetop;

private boolean     started; // true iff this thread has been started

/* Whether or not to single_step this thread. */

private boolean    single_step;

/* Whether or not the thread is a daemon thread. */

private boolean    daemon = false;

/* Whether or not this thread was asked to exit before it runs.*/

private boolean    stillborn = false;

/* What will be run. */

private Runnable target;

/* The group of this thread */

private ThreadGroup    group;

/* The context ClassLoader for this thread */

private ClassLoader contextClassLoader;

/* The inherited AccessControlContext of this thread */

private AccessControlContext inheritedAccessControlContext;

/* For autonumbering anonymous threads. */

private static int threadInitNumber;

/* ThreadLocal values pertaining to this thread. This map is maintained

* by the ThreadLocal class. */

ThreadLocal.ThreadLocalMap threadLocals = null;

/*

* InheritableThreadLocal values pertaining to this thread. This map is

* maintained by the InheritableThreadLocal class.

*/

ThreadLocal.ThreadLocalMap inheritableThreadLocals = null;

/*

* The requested stack size for this thread, or 0 if the creator did

* not specify a stack size.  It is up to the VM to do whatever it

* likes with this number; some VMs will ignore it.

*/

private long stackSize;

/*

* Thread ID

*/

private long tid;

/* For generating thread ID */

private static long threadSeqNumber;

/* Java thread status for tools,

* initialized to indicate thread 'not yet started'

*/

private int threadStatus = 0;

private static synchronized long nextThreadID() {

return ++threadSeqNumber;

}

/* The object in which this thread is blocked in an interruptible I/O

* operation, if any.  The blocker's interrupt method should be invoked

* after setting this thread's interrupt status.

*/

private volatile Interruptible blocker;

private Object blockerLock = new Object();

/* Set the blocker field; invoked via sun.misc.SharedSecrets from java.nio code

*/

void blockedOn(Interruptible b) {

synchronized (blockerLock) {

blocker = b;

}

}

/**

* The minimum priority that a thread can have.

*/

public final static int MIN_PRIORITY = 1;

/**

* The default priority that is assigned to a thread.

*/

public final static int NORM_PRIORITY = 5;

/**

* The maximum priority that a thread can have.

*/

public final static int MAX_PRIORITY = 10;

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值