Thread.stop()

Jason Baker jbaker at cs.utah.edu
Mon May 22 10:05:05 PDT 2000



I noticed some inconsistency in Thread.stop(Throwable).  When an
interruptable thread is stopped, the we get the calling thread's
stacktrace.  When a thread is asynchronously killed, we get the dying
thread's stacktrace, but not in the exception stop was passed in.  I
think we should always get the dying thread's stacktrace.  (Does
anyone know what the JDK does?)

Index: libraries/javalib/java/lang/Thread.java
===================================================================
RCS file: /cvs/kaffe/kaffe/libraries/javalib/java/lang/Thread.java,v
retrieving revision 1.32
diff -c -r1.32 Thread.java
*** libraries/javalib/java/lang/Thread.java	2000/05/03 19:50:30	1.32
--- libraries/javalib/java/lang/Thread.java	2000/05/22 16:54:46
***************
*** 459,464 ****
--- 459,465 ----
  	if (death != null) {
  		Error t = (Error)death;
  		death = null;
+ 		t.fillInStackTrace();
  		throw t;
  	}
  	holder = hold;
***************
*** 471,476 ****
--- 472,478 ----
  	if (death != null) {
  		Error t = (Error)death;
  		death = null;
+ 		t.fillInStackTrace();
  		throw t;
  	}
  }
***************
*** 481,486 ****
--- 483,489 ----
  	if (curr.death != null) {
  		Error t = (Error)curr.death;
  		curr.death = null;
+ 		t.fillInStackTrace();
  		throw t;
  	}
  }
Index: kaffe/kaffevm/thread.c
===================================================================
RCS file: /cvs/kaffe/kaffe/kaffe/kaffevm/thread.c,v
retrieving revision 1.35
diff -c -r1.35 thread.c
*** kaffe/kaffevm/thread.c	2000/03/30 21:15:56	1.35
--- kaffe/kaffevm/thread.c	2000/05/22 16:54:46
***************
*** 563,569 ****
  static void 
  throwDeath(void)
  {
! 	throwException(ThreadDeath);
  }
  
  static
--- 563,573 ----
  static void 
  throwDeath(void)
  {
! 	Hjava_lang_Thread *cur = getCurrentThread();
! 	Hjava_lang_Throwable *death = cur->death;
! 
! 	cur->death = NULL;
! 	throwException(death ? death : ThreadDeath);
  }
  
  static




More information about the kaffe mailing list