View Javadoc

1   // FullThreadUtils.java, created Mon Dec 16 18:57:12 2002 by mcmartin
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.Scheduler;
5   
6   import joeq.Class.PrimordialClassLoader;
7   import joeq.Class.jq_Class;
8   import joeq.Class.jq_InstanceMethod;
9   import joeq.Main.jq;
10  import joeq.Runtime.Reflection;
11  
12  /***
13   * @author  John Whaley <jwhaley@alum.mit.edu>
14   * @version $Id: FullThreadUtils.java 1474 2004-03-11 02:01:16Z jwhaley $
15   */
16  public class FullThreadUtils implements ThreadUtils.Delegate {
17      public joeq.Scheduler.jq_Thread getJQThread(java.lang.Thread t) {
18          if (!jq.RunningNative) {
19              if (!jq.IsBootstrapping) return null;
20              jq_Class k = joeq.Class.PrimordialClassLoader.getJavaLangThread();
21              joeq.Class.jq_InstanceField f = k.getOrCreateInstanceField("jq_thread", "Ljoeq/Scheduler/jq_Thread;");
22              return (joeq.Scheduler.jq_Thread)Reflection.getfield_A(t, f);
23          }
24          return ((joeq.ClassLib.Common.InterfaceImpl)joeq.ClassLib.ClassLibInterface.DEFAULT).getJQThread(t);
25      }
26      
27      public static final jq_Class _class = (jq_Class) PrimordialClassLoader.loader.getOrCreateBSType("Ljoeq/Scheduler/FullThreadUtils;");
28      public static final jq_InstanceMethod _getJQThread = _class.getOrCreateInstanceMethod("getJQThread", "(Ljava/lang/Thread;)Ljoeq/Scheduler/jq_Thread;");
29  }