Skip to content
This repository has been archived by the owner on Oct 27, 2023. It is now read-only.

Commit

Permalink
Disable AppDomain.ProcessExit hook to run shutdown hooks when running…
Browse files Browse the repository at this point in the history
  • Loading branch information
jfrijters committed Jun 15, 2012
1 parent 62b5ef0 commit 01ae451
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
2 changes: 2 additions & 0 deletions classpath/ikvm/internal/Util.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ public final class Util
{
private Util() {}

public static final boolean MONO = cli.System.Type.GetType("Mono.Runtime") != null;

public static final boolean WINDOWS;
public static final boolean MACOSX;

Expand Down
11 changes: 8 additions & 3 deletions openjdk/java/lang/Shutdown.java
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,14 @@ static void setRunFinalizersOnExit(boolean run) {

static {
try {
// AppDomain.ProcessExit has a LinkDemand, so we have to have a separate method
registerShutdownHook();
if (false) throw new cli.System.Security.SecurityException();
// MONOBUG Mono doesn't support starting a new thread during ProcessExit
// (and application shutdown hooks are based on threads)
// see https://bugzilla.xamarin.com/show_bug.cgi?id=5650
if (!ikvm.internal.Util.MONO) {
// AppDomain.ProcessExit has a LinkDemand, so we have to have a separate method
registerShutdownHook();
if (false) throw new cli.System.Security.SecurityException();
}
}
catch (cli.System.Security.SecurityException _) {
}
Expand Down

0 comments on commit 01ae451

Please sign in to comment.