diff options
author | David Daney <ddaney@avtrex.com> | 2007-02-16 21:23:10 +0000 |
---|---|---|
committer | David Daney <daney@gcc.gnu.org> | 2007-02-16 21:23:10 +0000 |
commit | 599b39ce9dcaba10e1c53934e50cca5f671a7f6e (patch) | |
tree | 295acd745105a2a979167a2ab8599425ebc13058 /libjava/java/lang/Thread.java | |
parent | d16c4b1a166ea5413487d3935c385ee82f560e81 (diff) | |
download | gcc-599b39ce9dcaba10e1c53934e50cca5f671a7f6e.zip gcc-599b39ce9dcaba10e1c53934e50cca5f671a7f6e.tar.gz gcc-599b39ce9dcaba10e1c53934e50cca5f671a7f6e.tar.bz2 |
Thread.java (Thread(ThreadGroup, Runnable, String)): Pass new parameter constructor.
* java/lang/Thread.java (Thread(ThreadGroup, Runnable, String)): Pass
new parameter constructor.
(Thread(ThreadGroup, Runnable, String, long)): Same.
(Thread(String, boolean)): New constructor.
(Thread(Thread, ThreadGroup, Runnable, String): Add parameter
noInheritableThreadLocal, don't call
InheritableThreadLocal.newChildThread if set.
* java/lang/PosixProcess.java(ProcessManager()): Set
noInheritableThreadLocal in super.
* java/lang/natThread.cc (_Jv_AttachCurrentThread): Pass new
parameter to Thread constructor.
(_Jv_AttachCurrentThreadAsDaemon): Same.
* java/lang/Thread.h: Regenerate.
* classpath/lib/java/lang/Thread.class: Same.
* classpath/lib/java/lang/PosixProcess$EOFInputStream.class: Same.
* classpath/lib/java/lang/PosixProcess.class: Same.
* classpath/lib/java/lang/Thread$State.class: Same.
* classpath/lib/java/lang/PosixProcess$ProcessManager.class: Same.
From-SVN: r122054
Diffstat (limited to 'libjava/java/lang/Thread.java')
-rw-r--r-- | libjava/java/lang/Thread.java | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/libjava/java/lang/Thread.java b/libjava/java/lang/Thread.java index 84682f3..1e1e860 100644 --- a/libjava/java/lang/Thread.java +++ b/libjava/java/lang/Thread.java @@ -355,7 +355,7 @@ public class Thread implements Runnable */ public Thread(ThreadGroup group, Runnable target, String name) { - this(currentThread(), group, target, name); + this(currentThread(), group, target, name, false); } /** @@ -381,10 +381,26 @@ public class Thread implements Runnable public Thread(ThreadGroup group, Runnable target, String name, long size) { // Just ignore stackSize for now. - this(currentThread(), group, target, name); + this(currentThread(), group, target, name, false); } - private Thread (Thread current, ThreadGroup g, Runnable r, String n) + /** + * Allocate a new Thread object for threads used internally to the + * run time. Runtime threads should not be members of an + * application ThreadGroup, nor should they execute arbitrary user + * code as part of the InheritableThreadLocal protocol. + * + * @param name the name for the Thread + * @param noInheritableThreadLocal if true, do not initialize + * InheritableThreadLocal variables for this thread. + * @throws IllegalThreadStateException if group is destroyed + */ + Thread(String name, boolean noInheritableThreadLocal) + { + this(null, null, null, name, noInheritableThreadLocal); + } + + private Thread (Thread current, ThreadGroup g, Runnable r, String n, boolean noInheritableThreadLocal) { // Make sure the current thread may create a new thread. checkAccess(); @@ -424,7 +440,10 @@ public class Thread implements Runnable int pri = current.getPriority(); priority = (gmax < pri ? gmax : pri); contextClassLoader = current.contextClassLoader; - InheritableThreadLocal.newChildThread(this); + // InheritableThreadLocal allows arbitrary user code to be + // executed, only do this if our caller desires it. + if (!noInheritableThreadLocal) + InheritableThreadLocal.newChildThread(this); } else { |