Install Perl 5.8.8
[msysgit.git] / mingw / html / lib / Thread / Signal.html
blob15a94a57042322826dfe5a71674fecc53f93ac85
1 <?xml version="1.0" ?>
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3 <html xmlns="http://www.w3.org/1999/xhtml">
4 <head>
5 <title>Thread::Signal - Start a thread which runs signal handlers reliably</title>
6 <meta http-equiv="content-type" content="text/html; charset=utf-8" />
7 <link rev="made" href="mailto:" />
8 </head>
10 <body style="background-color: white">
11 <table border="0" width="100%" cellspacing="0" cellpadding="3">
12 <tr><td class="block" style="background-color: #cccccc" valign="middle">
13 <big><strong><span class="block">&nbsp;Thread::Signal - Start a thread which runs signal handlers reliably</span></strong></big>
14 </td></tr>
15 </table>
17 <p><a name="__index__"></a></p>
18 <!-- INDEX BEGIN -->
20 <ul>
22 <li><a href="#name">NAME</a></li>
23 <li><a href="#caveat">CAVEAT</a></li>
24 <li><a href="#synopsis">SYNOPSIS</a></li>
25 <li><a href="#description">DESCRIPTION</a></li>
26 <li><a href="#bugs">BUGS</a></li>
27 </ul>
28 <!-- INDEX END -->
30 <hr />
31 <p>
32 </p>
33 <h1><a name="name">NAME</a></h1>
34 <p>Thread::Signal - Start a thread which runs signal handlers reliably (for old code)</p>
35 <p>
36 </p>
37 <hr />
38 <h1><a name="caveat">CAVEAT</a></h1>
39 <p>For new code the use of the <code>Thread::Signal</code> module is discouraged and
40 the direct use of the <code>threads</code> and associated modules is encouraged instead.</p>
41 <p>However, there is no direct equivalent of the Thread::Signal module in the
42 new implementation of threads. On the bright side: signals are now delivered
43 reliably to Perl programs that do not use threads. The handling of signals
44 with the new threading features is up to the underlying thread implementation
45 that is being used and may therefor be less reliable.</p>
46 <p>If you want to specify a thread-specific signal, you can alter the %SIG hash
47 in the thread where you want to handle a signal differently from other threads.
48 This at least seems to work under Linux. But there are no guarantees and your
49 mileage may vary.</p>
50 <p>For the whole story about the development of threads in Perl, and why you
51 should <strong>not</strong> be using this module unless you know what you're doing, see the
52 CAVEAT of the <code>Thread</code> module.</p>
53 <p>
54 </p>
55 <hr />
56 <h1><a name="synopsis">SYNOPSIS</a></h1>
57 <pre>
58 use Thread::Signal;</pre>
59 <pre>
60 $SIG{HUP} = \&amp;some_handler;</pre>
61 <p>
62 </p>
63 <hr />
64 <h1><a name="description">DESCRIPTION</a></h1>
65 <p>The <code>Thread::Signal</code> module starts up a special signal handler thread.
66 All signals to the process are delivered to it and it runs the
67 associated <code>$SIG{FOO}</code> handlers for them. Without this module,
68 signals arriving at inopportune moments (such as when perl's internals
69 are in the middle of updating critical structures) cause the perl
70 code of the handler to be run unsafely which can cause memory corruption
71 or worse.</p>
72 <p>
73 </p>
74 <hr />
75 <h1><a name="bugs">BUGS</a></h1>
76 <p>This module changes the semantics of signal handling slightly in that
77 the signal handler is run separately from the main thread (and in
78 parallel with it). This means that tricks such as calling <code>die</code> from
79 a signal handler behave differently (and, in particular, can't be
80 used to exit directly from a system call).</p>
81 <table border="0" width="100%" cellspacing="0" cellpadding="3">
82 <tr><td class="block" style="background-color: #cccccc" valign="middle">
83 <big><strong><span class="block">&nbsp;Thread::Signal - Start a thread which runs signal handlers reliably</span></strong></big>
84 </td></tr>
85 </table>
87 </body>
89 </html>