summaryrefslogtreecommitdiffstats
path: root/libjava/java/lang/Thread.java
diff options
context:
space:
mode:
authorbryce <bryce@138bc75d-0d04-0410-961f-82ee72b054a4>2000-06-20 13:30:14 +0000
committerbryce <bryce@138bc75d-0d04-0410-961f-82ee72b054a4>2000-06-20 13:30:14 +0000
commit3a1b73ed8e559637a3c76411640643a4163035f7 (patch)
tree5edeb41dea7e82739902a97679205e7fb75f32d3 /libjava/java/lang/Thread.java
parentfd5a29094d9a2e2b986cdca8a722c682b4aba538 (diff)
downloadppe42-gcc-3a1b73ed8e559637a3c76411640643a4163035f7.tar.gz
ppe42-gcc-3a1b73ed8e559637a3c76411640643a4163035f7.zip
2000-06-20 Bryce McKinlay <bryce@albatross.co.nz>
* java/lang/ThreadGroup.java: Merged with classpath. * prims.cc (_Jv_RunMain): Don't use ain_group'. * gnu/gcj/runtime/FirstThread.java: Remove ThreadGroup constructor argument. * java/lang/Thread.java (Thread): Bootstrap initial thread from ThreadGroup.root if Thread.currentThread is null. Honour the ThreadGroup's max priority setting. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@34615 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/java/lang/Thread.java')
-rw-r--r--libjava/java/lang/Thread.java27
1 files changed, 15 insertions, 12 deletions
diff --git a/libjava/java/lang/Thread.java b/libjava/java/lang/Thread.java
index 0d1133717dd..8be7f603798 100644
--- a/libjava/java/lang/Thread.java
+++ b/libjava/java/lang/Thread.java
@@ -198,19 +198,21 @@ public class Thread implements Runnable
public Thread (ThreadGroup g, Runnable r, String n)
{
- // Note that CURRENT can be null when we are creating the very
- // first thread. That's why we check it below.
Thread current = currentThread ();
-
- if (g != null)
+
+ if (g == null)
{
- // If CURRENT is null, then we are creating the first thread.
- // In this case we don't do the security check.
- if (current != null)
- g.checkAccess();
+ // If CURRENT is null, then we are bootstrapping the first thread.
+ // Use ThreadGroup.root, the main threadgroup.
+ if (current == null)
+ group = ThreadGroup.root;
+ else
+ group = current.getThreadGroup();
}
else
- g = current.getThreadGroup();
+ group = g;
+
+ group.checkAccess();
// The Class Libraries book says ``threadName cannot be null''. I
// take this to mean NullPointerException.
@@ -218,8 +220,7 @@ public class Thread implements Runnable
throw new NullPointerException ();
name = n;
- group = g;
- g.add(this);
+ group.add(this);
runnable = r;
data = null;
@@ -230,7 +231,9 @@ public class Thread implements Runnable
if (current != null)
{
daemon_flag = current.isDaemon();
- priority = current.getPriority();
+ int gmax = group.getMaxPriority();
+ int pri = current.getPriority();
+ priority = (gmax < pri ? gmax : pri);
}
else
{
OpenPOWER on IntegriCloud