All Packages  This Package  Class Hierarchy  Class Search  Index

Class posix.Signal
java.lang.Object
   |
   +----posix.Signal

  Summary

public class  Signal
     extends java.lang.Object
{
          // Fields 10
     public static final Signal SIGDANGER;
     public static final Signal SIGHUP;
     public static final Signal SIGINT;
     public static final Signal SIGQUIT;
     public static final Signal SIGTERM;
     public static final Signal SIGUSR1;
     public static final Signal SIGUSR2;
     public static final int SIG_DFL;
     public static final int SIG_EVT;
     public static final int SIG_IGN;

          // Methods 9
     public static native int kill(int, int);
     static void pollSignals();
     static native int sigwait();

     public void addSignalListener(SignalListener);
     public final int getAction();
     public void kill(int) throws IPCException;
     public void processSignal();
     public void removeSignalListener(SignalListener);
     public void setAction(int);
}

A posix signal. A posix signal represents an external event of some sort. For instance, SIGINTR means that a user interrupt signal was raised by the tty driver - usually because the user pressed the INTR key (typically ^C).

Some posix signals represent internal software errors. For example SIGBUS means that a load or store was attempted with incorrect alignment. We do not handle these internal events for Java - only the JVM could do something sensible with them. Furthermore, some posix signals are probably used by the JVM itself. For example, SIGCHLD means that a process started via Runtime.exec() has terminated. For this reason, only selected signals are exported via static constants.

Each Signal is in one of three states. SIG_DFL means that the default action is taken when the signal is received. This usually means stopping the JVM process. Whether any cleanup takes place depends on the JVM. SIG_IGN means that the signal is ignored. SIG_EVT means that the signal is converted to a JDK1.1 style Java event.

WARNING

The Signal class will not crash. However, whether or not a given signal can actually be trapped is highly dependent on both OS and JVM implementation. When multiple threads listen to the same signal, posix does not specify which thread gets the signal. So do not rely on a signal being trapped on all platforms. This may be rectified in the future if JNI provides some kind of signal interface, or posix provides some way of reliably distributing signals to multiple threads.

Author:
Stuart D. Gathman Copyright (C) 1998 Business Management Systems, Inc.

This code is distributed under the GNU Library General Public License

This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details.

You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.




  Fields

· SIGHUP

Summary  |  Top

   public static final Signal SIGHUP


· SIGINT

Summary  |  Top
   public static final Signal SIGINT


· SIGQUIT

Summary  |  Top
   public static final Signal SIGQUIT


· SIGUSR1

Summary  |  Top
   public static final Signal SIGUSR1


· SIGUSR2

Summary  |  Top
   public static final Signal SIGUSR2


· SIGDANGER

Summary  |  Top
   public static final Signal SIGDANGER

Paging space is low, or power failure.


· SIGTERM

Summary  |  Top
   public static final Signal SIGTERM

The process is being terminated.


· SIG_DFL

Summary  |  Top
   public static final int SIG_DFL


· SIG_IGN

Summary  |  Top
   public static final int SIG_IGN


· SIG_EVT

Summary  |  Top
   public static final int SIG_EVT


  Methods

· setAction

Summary  |  Top

   public void setAction(int action) 


· getAction

Summary  |  Top
   public final int getAction() 


· addSignalListener

Summary  |  Top
   public void addSignalListener(SignalListener l) 


· removeSignalListener

Summary  |  Top
   public void removeSignalListener(SignalListener l) 


· processSignal

Summary  |  Top
   public void processSignal() 

Send a SignalEvent to all listeners.



· pollSignals

Summary  |  Top
   static void pollSignals() 


· sigwait

Summary  |  Top
   static native int sigwait() 

Wait for signals. Mark which signals occured in the byte[].



· kill

Summary  |  Top
   public static native int kill(int pid, 
                                 int sig) 

Send signal to process using posix call.

Returns:
0 on success or errno


· kill

Summary  |  Top
   public void kill(int pid)  throws IPCException

Send this Signal to another process.

Parameter Description
the Posix process id



All Packages  This Package  Class Hierarchy  Class Search  Index
Freshly brewed Java API Documentation automatically generated with polardoc Version 1.0.7