Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/ikvm-fork.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjfrijters <jfrijters>2012-12-18 10:08:29 +0400
committerjfrijters <jfrijters>2012-12-18 10:08:29 +0400
commitd7517acd1a0eb4fc1605b217bf569c789d842731 (patch)
tree622edb6c54b9d1e72abd3d82f30dc5b85eb1be83 /openjdk/java
parentff1d0c0b13d2aec77d6279b9fd4e6b4cc8741ef6 (diff)
Only register the AppDomain.ProcessExit event handler when necessary.
Diffstat (limited to 'openjdk/java')
-rw-r--r--openjdk/java/lang/Shutdown.java10
1 files changed, 9 insertions, 1 deletions
diff --git a/openjdk/java/lang/Shutdown.java b/openjdk/java/lang/Shutdown.java
index 69304a94..947f0e39 100644
--- a/openjdk/java/lang/Shutdown.java
+++ b/openjdk/java/lang/Shutdown.java
@@ -60,6 +60,9 @@ class Shutdown {
// the index of the currently running shutdown hook to the hooks array
private static int currentRunningHook = 0;
+ // [IKVM] have we registered the AppDomain.ProcessExit event handler?
+ private static boolean registeredProcessExit;
+
/* The preceding static fields are protected by this lock */
private static class Lock { };
private static Object lock = new Lock();
@@ -74,7 +77,7 @@ class Shutdown {
}
}
- static {
+ private static void registerProcessExit() {
try {
// MONOBUG Mono doesn't support starting a new thread during ProcessExit
// (and application shutdown hooks are based on threads)
@@ -131,6 +134,11 @@ class Shutdown {
throw new IllegalStateException("Shutdown in progress");
}
+ if (!registeredProcessExit) {
+ registeredProcessExit = true;
+ registerProcessExit();
+ }
+
hooks[slot] = hook;
}
}