This file is indexed.

/usr/share/doc/mlton/guide/MLtonSignal is in mlton-doc 20100608-5.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta name="robots" content="index,nofollow">



<title>MLtonSignal - MLton Standard ML Compiler (SML Compiler)</title>
<link rel="stylesheet" type="text/css" charset="iso-8859-1" media="all" href="common.css">
<link rel="stylesheet" type="text/css" charset="iso-8859-1" media="screen" href="screen.css">
<link rel="stylesheet" type="text/css" charset="iso-8859-1" media="print" href="print.css">


<link rel="Start" href="Home">


</head>

<body lang="en" dir="ltr">

<script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
</script>
<script type="text/javascript">
_uacct = "UA-833377-1";
urchinTracker();
</script>
<table bgcolor = lightblue cellspacing = 0 style = "border: 0px;" width = 100%>
  <tr>
    <td style = "
		border: 0px;
		color: darkblue; 
		font-size: 150%;
		text-align: left;">
      <a class = mltona href="Home">MLton MLTONWIKIVERSION</a>
    <td style = "
		border: 0px;
		font-size: 150%;
		text-align: center;
		width: 50%;">
      MLtonSignal
    <td style = "
		border: 0px;
		text-align: right;">
      <table cellspacing = 0 style = "border: 0px">
        <tr style = "vertical-align: middle;">
      </table>
  <tr style = "background-color: white;">
    <td colspan = 3
	style = "
		border: 0px;
		font-size:70%;
		text-align: right;">
      <a href = "Home">Home</a>
      &nbsp;<a href = "TitleIndex">Index</a>
      &nbsp;
</table>
<div id="content" lang="en" dir="ltr">

<pre class=code>
<B><FONT COLOR="#0000FF">signature</FONT></B> MLTON_SIGNAL =
   <B><FONT COLOR="#0000FF">sig</FONT></B>
      <B><FONT COLOR="#A020F0">type</FONT></B><B><FONT COLOR="#228B22"> t </FONT></B>=<B><FONT COLOR="#228B22"> Posix.Signal.signal
      </FONT></B><B><FONT COLOR="#A020F0">type</FONT></B><B><FONT COLOR="#228B22"> signal </FONT></B>=<B><FONT COLOR="#228B22"> t

      </FONT></B><B><FONT COLOR="#0000FF">structure</FONT></B> Handler:
         <B><FONT COLOR="#0000FF">sig</FONT></B>
            <B><FONT COLOR="#A020F0">type</FONT></B><B><FONT COLOR="#228B22"> t

            </FONT></B><B><FONT COLOR="#A020F0">val</FONT></B> default: t
            <B><FONT COLOR="#A020F0">val</FONT></B> handler: (Thread.Runnable.t -&gt; Thread.Runnable.t) -&gt; t
            <B><FONT COLOR="#A020F0">val</FONT></B> ignore: t
            <B><FONT COLOR="#A020F0">val</FONT></B> isDefault: t -&gt; bool
            <B><FONT COLOR="#A020F0">val</FONT></B> isIgnore: t -&gt; bool
            <B><FONT COLOR="#A020F0">val</FONT></B> simple: (unit -&gt; unit) -&gt; t
         <B><FONT COLOR="#0000FF">end</FONT></B>

      <B><FONT COLOR="#0000FF">structure</FONT></B> Mask:
         <B><FONT COLOR="#0000FF">sig</FONT></B>
            <B><FONT COLOR="#A020F0">type</FONT></B><B><FONT COLOR="#228B22"> t
               
            </FONT></B><B><FONT COLOR="#A020F0">val</FONT></B> all: t
            <B><FONT COLOR="#A020F0">val</FONT></B> allBut: signal list -&gt; t
            <B><FONT COLOR="#A020F0">val</FONT></B> block: t -&gt; unit
            <B><FONT COLOR="#A020F0">val</FONT></B> getBlocked: unit -&gt; t
            <B><FONT COLOR="#A020F0">val</FONT></B> isMember: t * signal -&gt; bool
            <B><FONT COLOR="#A020F0">val</FONT></B> none: t
            <B><FONT COLOR="#A020F0">val</FONT></B> setBlocked: t -&gt; unit
            <B><FONT COLOR="#A020F0">val</FONT></B> some: signal list -&gt; t
            <B><FONT COLOR="#A020F0">val</FONT></B> unblock: t -&gt; unit
         <B><FONT COLOR="#0000FF">end</FONT></B>

      <B><FONT COLOR="#A020F0">val</FONT></B> getHandler: t -&gt; Handler.t
      <B><FONT COLOR="#A020F0">val</FONT></B> handled: unit -&gt; Mask.t
      <B><FONT COLOR="#A020F0">val</FONT></B> prof: t
      <B><FONT COLOR="#A020F0">val</FONT></B> restart: bool ref
      <B><FONT COLOR="#A020F0">val</FONT></B> setHandler: t * Handler.t -&gt; unit
      <B><FONT COLOR="#A020F0">val</FONT></B> suspend: Mask.t -&gt; unit
      <B><FONT COLOR="#A020F0">val</FONT></B> vtalrm: t
   <B><FONT COLOR="#0000FF">end</FONT></B>
</PRE>
<p>
 
</p>
<p>
Signals handlers are functions from (runnable) threads to (runnable) threads.  When a signal arrives, the corresponding signal handler is invoked, its argument being the thread that was interrupted by the signal.  The signal handler runs asynchronously, in its own thread. The signal handler returns the thread that it would like to resume execution (this is often the thread that it was passed).  It is an error for a signal handler to raise an exception that is not handled within the signal handler itself. 
</p>
<p>
A signal handler is never invoked while the running thread is in a critical section (see <a href="MLtonThread">MLtonThread</a>).  Invoking a signal handler implicitly enters a critical section and the normal return of a signal handler implicitly exits the critical section; hence, a signal handler is never interrupted by another signal handler. 
</p>

    <ul>

    <li>
<p>
 <tt>type&nbsp;t</tt>  <br>
the type of signals. 
</p>
</li>
    <li class="gap">
<p>
 <tt>type&nbsp;Handler.t</tt>  <br>
the type of signal handlers. 
</p>
</li>
    <li class="gap">
<p>
 <tt>Handler.default</tt>  <br>
handles the signal with the default action. 
</p>
</li>
    <li class="gap">
<p>
 <tt>Handler.handler&nbsp;f</tt>  <br>
returns a handler <tt>h</tt> such that when a signal <tt>s</tt> is handled  by <tt>h</tt>, <tt>f</tt> will be passed the thread that was interrupted by  <tt>s</tt> and should return the thread that will resume execution. 
</p>
</li>
    <li class="gap">
<p>
 <tt>Handler.ignore</tt>  <br>
is a handler that will ignore the signal. 
</p>
</li>
    <li class="gap">
<p>
 <tt>Handler.isDefault</tt>  <br>
returns true if the handler is the default handler. 
</p>
</li>
    <li class="gap">
<p>
 <tt>Handler.isIgnore</tt>  <br>
returns true if the handler is the ignore handler. 
</p>
</li>
    <li class="gap">
<p>
 <tt>Handler.simple&nbsp;f</tt>  <br>
returns a handler that executes <tt>f&nbsp;()</tt> and does not switch  threads. 
</p>
</li>
    <li class="gap">
<p>
 <tt>type&nbsp;Mask.t</tt>  <br>
the type of signal masks, which are sets of blocked signals. 
</p>
</li>
    <li class="gap">
<p>
 <tt>Mask.all</tt>  <br>
a mask of all signals. 
</p>
</li>
    <li class="gap">
<p>
 <tt>Mask.allBut&nbsp;l</tt>  <br>
a mask of all signals except for those in <tt>l</tt>. 
</p>
</li>
    <li class="gap">
<p>
 <tt>Mask.block&nbsp;m</tt>  <br>
blocks all signals in <tt>m</tt>. 
</p>
</li>
    <li class="gap">
<p>
 <tt>Mask.getBlocked&nbsp;()</tt>  <br>
gets the signal mask <tt>m</tt>, i.e. a signal is blocked if and only  if it is in <tt>m</tt>. 
</p>
</li>
    <li class="gap">
<p>
 <tt>Mask.isMember&nbsp;(m,&nbsp;s)</tt>  <br>
returns true if the signal <tt>s</tt> is in <tt>m</tt>. 
</p>
</li>
    <li class="gap">
<p>
 <tt>Mask.none</tt>  <br>
a mask of no signals. 
</p>
</li>
    <li class="gap">
<p>
 <tt>Mask.setBlocked&nbsp;m</tt>  <br>
sets the signal mask to <tt>m</tt>, i.e. a signal is blocked if and only  if it is in <tt>m</tt>. 
</p>
</li>
    <li class="gap">
<p>
 <tt>Mask.some&nbsp;l</tt>  <br>
a mask of the signals in <tt>l</tt>. 
</p>
</li>
    <li class="gap">
<p>
 <tt>Mask.unblock&nbsp;m</tt>  <br>
unblocks all signals in <tt>m</tt>. 
</p>
</li>
    <li class="gap">
<p>
 <tt>getHandler&nbsp;s</tt>  <br>
returns the current handler for signal <tt>s</tt>. 
</p>
</li>
    <li class="gap">
<p>
 <tt>handled&nbsp;()</tt>  <br>
returns the signal mask <tt>m</tt> corresponding to the currently handled  signals; i.e., a signal is handled if and only if it is in <tt>m</tt>. 
</p>
</li>
    <li class="gap">
<p>
 <tt>prof</tt>  <br>
<tt>SIGPROF</tt>, the profiling signal. 
</p>
</li>
    <li class="gap">
<p>
 <tt>restart</tt>  <br>
dynamically determines the behavior of interrupted system calls; when  <tt>true</tt>, interrupted system calls are restarted; when <tt>false</tt>,  interrupted system calls raise <tt>OS.SysError</tt>. 
</p>
</li>
    <li class="gap">
<p>
 <tt>setHandler&nbsp;(s,&nbsp;h)</tt>  <br>
sets the handler for signal <tt>s</tt> to <tt>h</tt>. 
</p>
</li>
    <li class="gap">
<p>
 <tt>suspend&nbsp;m</tt>  <br>
temporarily sets the signal mask to <tt>m</tt> and suspends until an  unmasked signal is received and handled, at which point  <tt>suspend</tt> resets the mask and returns. 
</p>
</li>
    <li class="gap">
<p>
 <tt>vtalrm</tt>  <br>
<tt>SIGVTALRM</tt>, the signal for virtual timers. 
</p>
</li>

    </ul>


<h2 id="head-f8a475209a6f55001051eae0624aca8b3a75b651">Interruptible System Calls</h2>
<p>
Signal handling interacts in a non-trivial way with those functions in the <a href="BasisLibrary">Basis Library</a> that correspond directly to interruptible system calls (a subset of those functions that may raise <tt>OS.SysError</tt>).  The desire is that these functions should have predictable semantics.  The principal concerns are: 
</p>

    <ol type="1">

    <li>
<p>
System calls that are interrupted by signals should, by default, be  restarted; the alternative is to raise   
<pre> OS.SysError (Posix.Error.errorMsg Posix.Error.intr, 
              SOME Posix.Error.intr)</pre> This behavior is determined dynamically by the value of <tt>Signal.restart</tt>. 
</p>
</li>
    <li class="gap">
<p>
Signal handlers should always get a chance to run (when outside a  critical region).  If a system call is interrupted by a signal, then  the signal handler will run before the call is restarted or  <tt>OS.SysError</tt> is raised; that is, before the <tt>Signal.restart</tt>  check. 
</p>
</li>
    <li class="gap">
<p>
A system call that must be restarted while in a critical section  will be restarted with the handled signals blocked (and the previously  blocked signals remembered).  This encourages the system call to  complete, allowing the program to make progress towards leaving the  critical section where the signal can be handled.  If the system call  completes, the set of blocked signals are restored to those previously  blocked. 
</p>
</li>
</ol>

</div>



<p>
<hr>
Last edited on 2007-12-01 21:41:45 by <span title="fenrir.uchicago.edu"><a href="MatthewFluet">MatthewFluet</a></span>.
</body></html>