Changeset 341 for trunk/openjdk/hotspot


Ignore:
Timestamp:
Mar 8, 2012, 2:46:46 PM (13 years ago)
Author:
dmik
Message:

jdk: Create JVM on main thread in Java executables on OS/2.

This fixes hangs at crashes when the Java process is killed
externally by Ctrl-C or by a kill signal (#33 and #159).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/openjdk/hotspot/src/share/tools/launcher/java.c

    r309 r341  
    7979#include <string.h>
    8080
     81#ifdef __OS2__
     82#include <float.h> // for _control87
     83#endif
     84
    8185#include <jni.h>
    8286#include <jvm.h>
     
    387391      args.ifn = ifn;
    388392
     393#ifdef __OS2__
     394      // On OS/2, both Ctrl-C and process termination handlers (including DLL
     395      // uninitialization code) are always called on thread 1. If we fire off
     396      // a new thread here and create the JVM on it (as other platfroms do),
     397      // thread 1 will be not known to the JVM and this can cause various
     398      // nexpected side-effects like hangs and crashes at Java process
     399      // termination (see #33 and #159 for details). For this reason, we instead
     400      // create the JVM right on thread 1.
     401
     402      // disable FPU exceptions (taken from jdk/src/windows/hpi/src/system_md.c)
     403      _control87(MCW_EM | RC_NEAR | PC_53, MCW_EM | MCW_RC | MCW_PC);
     404
     405      return JavaMain(&args);
     406#else
    389407      return ContinueInNewThread(JavaMain, threadStackSize, (void*)&args);
     408#endif
    390409    }
    391410}
Note: See TracChangeset for help on using the changeset viewer.