Oliver Deakin wrote:
Gregory Shimansky wrote:
Leo Li wrote:
On 10/15/07, Alexey Varlamov <[EMAIL PROTECTED]> wrote:
2007/10/15, Alexey Varlamov <[EMAIL PROTECTED]>:
2007/10/14, Gregory Shimansky <[EMAIL PROTECTED]>:
<SNIP>
The bug of RI [4] (fixed in 1.5) being referred by Oliver is a bit
wider than just printing out the stack trace. Synopsis reads:
"(thread) setUncaughtExceptionHandler() doesn't work on main thread ".
I believe this is really strong argument to use DetachCurrentThread
and be compatible with RI rather than spec (which should be fixed and
will be someday ;)
FYI, spec is indeed fixed in 1.6 :
http://java.sun.com/javase/6/docs/technotes/guides/jni/spec/invocation.html#wp16553
The clue from the change in spec is enough to show that it is
appropriate to call DetachCurrentThread() in the main thread when
shutdowning VM.
Ok if DestroyJavaVM is called after DetachCurrentThread the bug in
HARMONY-3532 will reappear. It looks like DRLVM shutdown sequence
should be fixed to execute shutdown hooks when DetachCurrentThread is
called for the last thread, instead of doing it in DestroyJavaVM.
I take it the patches applied as part of HARMONY-3532 did not fully
resolve the issue?
It seems from the changes in the spec linked by Alexey that we are now
allowed to detach the main thread and, in fact, we are expected to do so
on the main thread if we wish any registered exception handlers to be
called. It seems, as you suggest, that this is now something that should
be fixed in DRLVM to match the RI.
Is it ok for me to go ahead and add the DetachCurrentThread() call to
main.c immediately, or is HARMONY-3532 a big enough issue that you would
like me to wait for it to be resolved first?
I would say go ahead and make the change in main.c. Then we'll see
whether the problem in HARMONY-3532 is back or not.
--
Gregory