/[classpath]/classpath/vm/reference/java/lang/Thread.java
ViewVC logotype

Diff of /classpath/vm/reference/java/lang/Thread.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.16 by mark, Tue Jan 22 22:27:03 2002 UTC revision 1.17 by mark, Mon Feb 18 15:53:32 2002 UTC
# Line 74  public class Thread implements Runnable Line 74  public class Thread implements Runnable
74          boolean daemon;          boolean daemon;
75          int priority;          int priority;
76    
77            /** The context classloader for this Thread. **/
78            private ClassLoader contextClassLoader
79                                    = ClassLoader.getSystemClassLoader();
80    
81          /** The maximum priority for a Thread.          /** The maximum priority for a Thread.
82           ** @XXX find out the value for this.           ** @XXX find out the value for this.
83           **/           **/
# Line 228  public class Thread implements Runnable Line 232  public class Thread implements Runnable
232    
233                  priority = currentThread().getPriority();                  priority = currentThread().getPriority();
234                  daemon = currentThread().isDaemon();                  daemon = currentThread().isDaemon();
235                    contextClassLoader = currentThread().getContextClassLoader();
236                  nativeInit();                  nativeInit();
237    
238                  this.group.addThread(this);                  this.group.addThread(this);
# Line 285  public class Thread implements Runnable Line 290  public class Thread implements Runnable
290           ** If you stop a Thread that has not yet started, it will stop           ** If you stop a Thread that has not yet started, it will stop
291           ** immediately when it is actually started.<P>           ** immediately when it is actually started.<P>
292           **           **
293             ** @deprecated unsafe operation.
294             **
295           ** @exception SecurityException if you cannot modify this Thread.           ** @exception SecurityException if you cannot modify this Thread.
296           ** @XXX it doesn't yet implement that second requirement.           ** @XXX it doesn't yet implement that second requirement.
297           **/           **/
# Line 298  public class Thread implements Runnable Line 305  public class Thread implements Runnable
305           ** If you stop a Thread that has not yet started, it will stop           ** If you stop a Thread that has not yet started, it will stop
306           ** immediately when it is actually started.<P>           ** immediately when it is actually started.<P>
307           **           **
308             ** @deprecated unsafe operation.
309             **
310           ** @param t the Throwable to throw when the Thread dies.           ** @param t the Throwable to throw when the Thread dies.
311           ** @exception SecurityException if you cannot modify this Thread.           ** @exception SecurityException if you cannot modify this Thread.
312           ** @XXX it doesn't yet implement that second requirement.           ** @XXX it doesn't yet implement that second requirement.
# Line 336  public class Thread implements Runnable Line 345  public class Thread implements Runnable
345          /** Suspend this Thread.  It will not come back, ever, unless          /** Suspend this Thread.  It will not come back, ever, unless
346           ** it is resumed.  It is not clear whether locks should be           ** it is resumed.  It is not clear whether locks should be
347           ** released until resumption, but it is likely.           ** released until resumption, but it is likely.
348             **
349             ** @deprecated depends on <code>suspend()</code>.
350             **
351           ** @exception SecurityException if you cannot modify this Thread.           ** @exception SecurityException if you cannot modify this Thread.
352           **/           **/
353          public final synchronized void suspend() {          public final synchronized void suspend() {
# Line 345  public class Thread implements Runnable Line 357  public class Thread implements Runnable
357                    
358          /** Resume this Thread.  If the thread is not suspended, this          /** Resume this Thread.  If the thread is not suspended, this
359           ** method does nothing.           ** method does nothing.
360             **
361             ** @deprecated depends on <code>suspend()</code>.
362             **
363           ** @exception SecurityException if you cannot modify this Thread.           ** @exception SecurityException if you cannot modify this Thread.
364           **/           **/
365          public final synchronized void resume() {          public final synchronized void resume() {
# Line 494  public class Thread implements Runnable Line 509  public class Thread implements Runnable
509          /** Count the number of stack frames in this Thread.  The Thread          /** Count the number of stack frames in this Thread.  The Thread
510           ** in question must be suspended when this occurs.           ** in question must be suspended when this occurs.
511           **           **
512             ** @deprecated depends on <code>suspend</code>.
513           ** @return the number of stack frames in this Thread.           ** @return the number of stack frames in this Thread.
514           ** @exception IllegalThreadStateException if this Thread is           ** @exception IllegalThreadStateException if this Thread is
515           **            not suspended.           **            not suspended.
# Line 524  public class Thread implements Runnable Line 540  public class Thread implements Runnable
540           ** @exception SecurityException if the current Thread cannot           ** @exception SecurityException if the current Thread cannot
541           **            modify this Thread.           **            modify this Thread.
542           **/           **/
543          public void checkAccess() {          public final void checkAccess() {
544                  SecurityManager sm = System.getSecurityManager();                  SecurityManager sm = System.getSecurityManager();
545                  if(sm != null) {                  if(sm != null) {
546                          sm.checkAccess(this);                          sm.checkAccess(this);
# Line 548  public class Thread implements Runnable Line 564  public class Thread implements Runnable
564          final native void nativeResume();          final native void nativeResume();
565          final native void nativeSetPriority(int newPriority);          final native void nativeSetPriority(int newPriority);
566    
567          public ClassLoader getContextClassLoader() {          /**
568                  return(this.getClass().getClassLoader()); // For now           * Returns the context classloader of this Thread. The context
569             * classloader can be used by code that want to load classes depending
570             * on the current thread. Normally classes are loaded depending on
571             * the classloader of the current class.
572             *
573             * @exception SecurityException when the calling code does not have
574             * <code>RuntimePermission("getClassLoader")</code>.
575             */
576            public ClassLoader getContextClassLoader()
577            {
578              SecurityManager sm = System.getSecurityManager();
579              if (sm != null)
580                sm.checkPermission(new RuntimePermission("getClassLoader"));
581    
582              return contextClassLoader;
583            }
584    
585            /**
586             * Sets the context classloader for this Thread. When not explicitly
587             * set the context classloader for a thread is the same as the context
588             * classloader of the thread that created this thread. The first
589             * thread has as context classloader the system classloader.
590             *
591             * @exception SecurityException when the calling code does not have
592             * <code>RuntimePermission("setContextClassLoader")</code>.
593             */
594            public void setContextClassLoader(ClassLoader classloader)
595            {
596              SecurityManager sm = System.getSecurityManager();
597              if (sm != null)
598                sm.checkPermission(new RuntimePermission("setContextClassLoader"));
599    
600              this.contextClassLoader = classloader;
601          }          }
602  }  }

Legend:
Removed from v.1.16  
changed lines
  Added in v.1.17

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26