<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="polydoc.xsl"?>
<polydoc>
<title>Signature SIGNAL Structure Signal</title>
<navigation>
<parent href="Basis.html">Basis</parent>
<previous href="HashArray.xml">HashArray</previous>
<next href="SingleAssignment.xml">SingleAssignment</next>
</navigation>
<headtext>
<p>
Although the <identifier>Posix</identifier> structure in the Standard Basis Library provides functions
which send signals to a process there is no standard method of handling signals. The
<identifier>Signal</identifier> structure has been added to Poly/ML to allow signals to be blocked or
handled.
</p></headtext>
<topdecs>
<summary>signature SIGNAL:
sig
    datatype sig_handle =
        SIG_DFL |
        SIG_IGN |
        SIG_HANDLE of int -&gt; unit
    val signal: int * sig_handle -&gt; sig_handle
end
structure Signal: SIGNAL
</summary>
<bindings><binding>
<code>datatype <definition>sig_handle</definition> = SIG_DFL | SIG_IGN | SIG_HANDLE of int -&gt; unit
</code>
<text><p></p></text>
</binding>
<binding>
<code>val <definition>signal</definition> : int * sig_handle -&gt; sig_handle
</code>
<text><p></p></text>
</binding>
</bindings>
</topdecs>
<tailtext>
<p>
The <identifier>Signal.signal</identifier> function takes as its arguments a signal number and an
action and returns the previous action. The action may be <identifier>SIG_DFL</identifier>,
indicating the default action, <identifier>SIG_IGN</identifier>, indicating that the signal should be
ignored (blocked) or <identifier>SIG_HANDLE</identifier>, which allows a handler function to be installed.</p>
<p>Signals are represented as integers using the normal Unix signal numbering. In
the Unix implementations of Poly/ML the type <identifier>Posix.Signal.signal</identifier> is the same as <identifier>int</identifier>
so the constants from <identifier>Posix.Signal</identifier> can be used as arguments to <identifier>Signal.signal</identifier>.</p>
<p>The default action depends on the signal. For some signals it is to ignore the
signal, for others the process is killed. See the signal man page in Unix for a list
of the default actions.</p>
<p>A handler function installed using <identifier>SIG_HANDLE</identifier> is run as a separate thread
some time after a signal arrives. </p>
<p>Some signals are used internally by Poly/ML.  In particular <identifier>SIGVTALRM</identifier> is used
by the profiling mechanism.</p>
<p>The Signal structure is provided in the Windows implementation but only the 
console interrupt signal (2) has effect.</p>
<p></p></tailtext>
</polydoc>
