View Javadoc

1   // Thread.java, created Thu Sep  5 10:48:53 2002 by joewhaley
2   // Copyright (C) 2001-3 John Whaley <jwhaley@alum.mit.edu>
3   // Licensed under the terms of the GNU LGPL; see COPYING for details.
4   package joeq.ClassLib.apple13_osx.java.lang;
5   
6   import joeq.Scheduler.jq_Thread;
7   
8   /***
9    * Thread
10   *
11   * @author  John Whaley <jwhaley@alum.mit.edu>
12   * @version $Id: Thread.java 1451 2004-03-09 06:27:08Z jwhaley $
13   */
14  public abstract class Thread {
15  
16      public final jq_Thread jq_thread;
17  
18      private void init(java.lang.ThreadGroup g, java.lang.Runnable target, java.lang.String name) {
19          this.init(g, target, name, true);
20      }
21      private native void init(java.lang.ThreadGroup g, java.lang.Runnable target, java.lang.String name, boolean setpriority);
22      private static synchronized native int nextThreadNum();
23  
24      private Thread(java.lang.ThreadGroup group, java.lang.Runnable target, boolean set_priority) {
25          java.lang.Object o = this;
26          jq_Thread t = new jq_Thread((java.lang.Thread)o);
27          this.jq_thread = t;
28          java.lang.String name = "Thread-" + nextThreadNum();
29          this.init(group, target, name, false);
30          t.init();
31      }
32  
33      private Thread(java.lang.ThreadGroup group, java.lang.String name, boolean set_priority) {
34          java.lang.Object o = this;
35          jq_Thread t = new jq_Thread((java.lang.Thread)o);
36          this.jq_thread = t;
37          this.init(group, null, name, false);
38          t.init();
39      }
40      
41  }