Add to git.
[pthrlib.git] / doc / pth_die.3.html
1 <html>
2 <head>
3 <meta name="generator" content="groff -Thtml, see www.gnu.org">
4 <meta name="Content-Style" content="text/css">
5 <title>pth_exit</title>
6 </head>
7 <body>
8
9 <h1 align=center>pth_exit</h1>
10 <a href="#NAME">NAME</a><br>
11 <a href="#SYNOPSIS">SYNOPSIS</a><br>
12 <a href="#DESCRIPTION">DESCRIPTION</a><br>
13 <a href="#AUTHOR">AUTHOR</a><br>
14 <a href="#LICENSE">LICENSE</a><br>
15 <a href="#VERSION">VERSION</a><br>
16
17 <hr>
18 <!-- Creator     : groff version 1.17.2 -->
19 <!-- CreationDate: Fri Aug 30 16:16:33 2002 -->
20 <a name="NAME"></a>
21 <h2>NAME</h2>
22 <table width="100%" border=0 rules="none" frame="void"
23        cols="2" cellspacing="0" cellpadding="0">
24 <tr valign="top" align="left">
25 <td width="10%"></td><td width="90%">
26 pth_exit, pth_die, pth_catch - exit a pseudothread and exception handling</td></table>
27 <a name="SYNOPSIS"></a>
28 <h2>SYNOPSIS</h2>
29
30 <table width="100%" border=0 rules="none" frame="void"
31        cols="2" cellspacing="0" cellpadding="0">
32 <tr valign="top" align="left">
33 <td width="10%"></td><td width="90%">
34 <pre><b>#include &lt;pthr_pseudothread.h&gt;
35
36 void pth_exit (pseudothread) __attribute__((noreturn));
37 #define pth_die(pth,msg) _pth_die ((pth), (msg), __FILE__, __LINE__)
38 const char *pth_catch (pseudothread pth, void (*fn) (void *), void *data);
39 </b></pre></td></table>
40 <a name="DESCRIPTION"></a>
41 <h2>DESCRIPTION</h2>
42
43 <table width="100%" border=0 rules="none" frame="void"
44        cols="2" cellspacing="0" cellpadding="0">
45 <tr valign="top" align="left">
46 <td width="10%"></td><td width="90%">
47 <b>pth_exit</b> causes the current thread to exit
48 immediately. Note: you cannot force another thread to exit
49 by calling this function. If you try to do that, strange and
50 undefined things are likely to happen. Only the currently
51 running thread may call <b>pth_exit</b> on
52 itself.</td></table>
53
54 <table width="100%" border=0 rules="none" frame="void"
55        cols="2" cellspacing="0" cellpadding="0">
56 <tr valign="top" align="left">
57 <td width="10%"></td><td width="90%">
58 <b>pth_die</b> is similar in concept to <b>pth_exit</b>,
59 except that it throws an exception which may be caught by
60 using the <b>pth_catch</b> function. The distinction between
61 <b>pth_die</b> and <b>pth_exit</b> is the same as the
62 distinction between the Perl functions <b>die</b> and
63 <b>exit</b>, in as much as <b>exit</b> in Perl always exits
64 the process immediately, and <b>die</b> in Perl generally
65 exits the process immediately unless the programmer catches
66 the exception with <b>eval</b> and handles it
67 appropriately.</td></table>
68
69 <table width="100%" border=0 rules="none" frame="void"
70        cols="2" cellspacing="0" cellpadding="0">
71 <tr valign="top" align="left">
72 <td width="10%"></td><td width="90%">
73 <b>pth_catch</b> is used to catch exceptions thrown by
74 <b>pth_die</b>. You give <b>fn</b> (function) and
75 <b>data</b> arguments, and the function calls <b>fn
76 (data)</b>. If, during this call, the code calls
77 <b>pth_die</b>, then the exception message is immediately
78 returned from <b>pth_catch</b>. If the code runs
79 successfully to completion, then <b>pth_catch</b> will
80 return <b>NULL</b>.</td></table>
81
82 <table width="100%" border=0 rules="none" frame="void"
83        cols="2" cellspacing="0" cellpadding="0">
84 <tr valign="top" align="left">
85 <td width="10%"></td><td width="90%">
86 Exceptions may be nested.</td></table>
87
88 <table width="100%" border=0 rules="none" frame="void"
89        cols="2" cellspacing="0" cellpadding="0">
90 <tr valign="top" align="left">
91 <td width="10%"></td><td width="90%">
92 Note that <b>pth_catch</b> will not catch calls to
93 <b>pth_exit</b>.</td></table>
94 <a name="AUTHOR"></a>
95 <h2>AUTHOR</h2>
96
97 <table width="100%" border=0 rules="none" frame="void"
98        cols="2" cellspacing="0" cellpadding="0">
99 <tr valign="top" align="left">
100 <td width="10%"></td><td width="90%">
101 Richard Jones &lt;rich@annexia.org&gt;</td></table>
102 <a name="LICENSE"></a>
103 <h2>LICENSE</h2>
104
105 <table width="100%" border=0 rules="none" frame="void"
106        cols="2" cellspacing="0" cellpadding="0">
107 <tr valign="top" align="left">
108 <td width="10%"></td><td width="90%">
109 GNU LGPL (see http://www.gnu.org/)</td></table>
110 <a name="VERSION"></a>
111 <h2>VERSION</h2>
112
113 <table width="100%" border=0 rules="none" frame="void"
114        cols="2" cellspacing="0" cellpadding="0">
115 <tr valign="top" align="left">
116 <td width="10%"></td><td width="90%">
117 pthrlib-3.0.3</td></table>
118 <hr>
119 </body>
120 </html>