jdk/src/share/bin/java.c
/*
* Always detach the main thread so that it appears to have ended when
* the application's main method exits. This will invoke the
* uncaught exception handler machinery if main threw an
* exception. An uncaught exception handler cannot change the
* launcher's return code except by calling System.exit.
*
* Wait for all non-daemon threads to end, then destroy the VM.
* This will actually create a trivial new Java waiter thread
* named "DestroyJavaVM", but this will be seen as a different
* thread from the one that executed main, even though they are
* the same C thread. This allows mainThread.join() and
* mainThread.isAlive() to work as expected.
*/
#define LEAVE() \
{- -------------------------------------------
(1) DetachCurrentThread() でメインスレッドをデタッチしておく.
---------------------------------------- -}
if ((*vm)->DetachCurrentThread(vm) != 0) { \
JLI_ReportErrorMessage(JVM_ERROR2); \
ret = 1; \
} \
{- -------------------------------------------
(1) jni_DestroyJavaVM() を呼んで HotSpot の終了処理を行う.
---------------------------------------- -}
(*vm)->DestroyJavaVM(vm); \
{- -------------------------------------------
(1) 結果をリターン
---------------------------------------- -}
return ret \
This document is available under the GNU GENERAL PUBLIC LICENSE Version 2.