src/share/classes/sun/misc/Signal.java
Print this page
*** 70,81 ****
* @author Bill Shannon
* @see sun.misc.SignalHandler
* @since 1.2
*/
public final class Signal {
! private static Hashtable handlers = new Hashtable(4);
! private static Hashtable signals = new Hashtable(4);
private int number;
private String name;
/* Returns the signal number */
--- 70,81 ----
* @author Bill Shannon
* @see sun.misc.SignalHandler
* @since 1.2
*/
public final class Signal {
! private static Hashtable<Signal,SignalHandler> handlers = new Hashtable<>(4);
! private static Hashtable<Integer,Signal> signals = new Hashtable<>(4);
private int number;
private String name;
/* Returns the signal number */
*** 164,176 ****
long oldH = handle0(sig.number, newH);
if (oldH == -1) {
throw new IllegalArgumentException
("Signal already used by VM or OS: " + sig);
}
! signals.put(new Integer(sig.number), sig);
synchronized (handlers) {
! SignalHandler oldHandler = (SignalHandler)handlers.get(sig);
handlers.remove(sig);
if (newH == 2) {
handlers.put(sig, handler);
}
if (oldH == 0) {
--- 164,176 ----
long oldH = handle0(sig.number, newH);
if (oldH == -1) {
throw new IllegalArgumentException
("Signal already used by VM or OS: " + sig);
}
! signals.put(sig.number, sig);
synchronized (handlers) {
! SignalHandler oldHandler = handlers.get(sig);
handlers.remove(sig);
if (newH == 2) {
handlers.put(sig, handler);
}
if (oldH == 0) {
*** 198,209 ****
raise0(sig.number);
}
/* Called by the VM to execute Java signal handlers. */
private static void dispatch(final int number) {
! final Signal sig = (Signal)signals.get(new Integer(number));
! final SignalHandler handler = (SignalHandler)handlers.get(sig);
Runnable runnable = new Runnable () {
public void run() {
// Don't bother to reset the priority. Signal handler will
// run at maximum priority inherited from the VM signal
--- 198,209 ----
raise0(sig.number);
}
/* Called by the VM to execute Java signal handlers. */
private static void dispatch(final int number) {
! final Signal sig = signals.get(number);
! final SignalHandler handler = handlers.get(sig);
Runnable runnable = new Runnable () {
public void run() {
// Don't bother to reset the priority. Signal handler will
// run at maximum priority inherited from the VM signal