| 1 | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> |
| 2 | <html> |
| 3 | <head> |
| 4 | <link rel="STYLESHEET" href="api.css" type='text/css' /> |
| 5 | <link rel="SHORTCUT ICON" href="../icons/pyfav.png" type="image/png" /> |
| 6 | <link rel='start' href='../index.html' title='Python Documentation Index' /> |
| 7 | <link rel="first" href="api.html" title='Python/C API Reference Manual' /> |
| 8 | <link rel='contents' href='contents.html' title="Contents" /> |
| 9 | <link rel='index' href='genindex.html' title='Index' /> |
| 10 | <link rel='last' href='about.html' title='About this document...' /> |
| 11 | <link rel='help' href='about.html' title='About this document...' /> |
| 12 | <link rel="next" href="importing.html" /> |
| 13 | <link rel="prev" href="os.html" /> |
| 14 | <link rel="parent" href="utilities.html" /> |
| 15 | <link rel="next" href="importing.html" /> |
| 16 | <meta name='aesop' content='information' /> |
| 17 | <title>5.2 Process Control </title> |
| 18 | </head> |
| 19 | <body> |
| 20 | <DIV CLASS="navigation"> |
| 21 | <div id='top-navigation-panel' xml:id='top-navigation-panel'> |
| 22 | <table align="center" width="100%" cellpadding="0" cellspacing="2"> |
| 23 | <tr> |
| 24 | <td class='online-navigation'><a rel="prev" title="5.1 Operating System Utilities" |
| 25 | href="os.html"><img src='../icons/previous.png' |
| 26 | border='0' height='32' alt='Previous Page' width='32' /></A></td> |
| 27 | <td class='online-navigation'><a rel="parent" title="5. Utilities" |
| 28 | href="utilities.html"><img src='../icons/up.png' |
| 29 | border='0' height='32' alt='Up One Level' width='32' /></A></td> |
| 30 | <td class='online-navigation'><a rel="next" title="5.3 Importing Modules" |
| 31 | href="importing.html"><img src='../icons/next.png' |
| 32 | border='0' height='32' alt='Next Page' width='32' /></A></td> |
| 33 | <td align="center" width="100%">Python/C API Reference Manual</td> |
| 34 | <td class='online-navigation'><a rel="contents" title="Table of Contents" |
| 35 | href="contents.html"><img src='../icons/contents.png' |
| 36 | border='0' height='32' alt='Contents' width='32' /></A></td> |
| 37 | <td class='online-navigation'><img src='../icons/blank.png' |
| 38 | border='0' height='32' alt='' width='32' /></td> |
| 39 | <td class='online-navigation'><a rel="index" title="Index" |
| 40 | href="genindex.html"><img src='../icons/index.png' |
| 41 | border='0' height='32' alt='Index' width='32' /></A></td> |
| 42 | </tr></table> |
| 43 | <div class='online-navigation'> |
| 44 | <b class="navlabel">Previous:</b> |
| 45 | <a class="sectref" rel="prev" href="os.html">5.1 Operating System Utilities</A> |
| 46 | <b class="navlabel">Up:</b> |
| 47 | <a class="sectref" rel="parent" href="utilities.html">5. Utilities</A> |
| 48 | <b class="navlabel">Next:</b> |
| 49 | <a class="sectref" rel="next" href="importing.html">5.3 Importing Modules</A> |
| 50 | </div> |
| 51 | <hr /></div> |
| 52 | </DIV> |
| 53 | <!--End of Navigation Panel--> |
| 54 | |
| 55 | <H1><A NAME="SECTION007200000000000000000"></A><A NAME="processControl"></A> |
| 56 | <BR> |
| 57 | 5.2 Process Control |
| 58 | </H1> |
| 59 | |
| 60 | <P> |
| 61 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"><td><nobr>void <b><tt id='l2h-162' xml:id='l2h-162' class="cfunction">Py_FatalError</tt></b>(</nobr></td><td>const char *<var>message</var>)</td></tr></table></dt> |
| 62 | <dd> |
| 63 | Print a fatal error message and kill the process. No cleanup is |
| 64 | performed. This function should only be invoked when a condition is |
| 65 | detected that would make it dangerous to continue using the Python |
| 66 | interpreter; e.g., when the object administration appears to be |
| 67 | corrupted. On <span class="Unix">Unix</span>, the standard C library function |
| 68 | <tt class="cfunction">abort()</tt><a id='l2h-165' xml:id='l2h-165'></a> is called which will attempt to |
| 69 | produce a <span class="file">core</span> file. |
| 70 | </dd></dl> |
| 71 | |
| 72 | <P> |
| 73 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"><td><nobr>void <b><tt id='l2h-163' xml:id='l2h-163' class="cfunction">Py_Exit</tt></b>(</nobr></td><td>int <var>status</var>)</td></tr></table></dt> |
| 74 | <dd> |
| 75 | Exit the current process. This calls |
| 76 | <tt class="cfunction">Py_Finalize()</tt><a id='l2h-166' xml:id='l2h-166'></a> and then calls the |
| 77 | standard C library function |
| 78 | <code>exit(<var>status</var>)</code><a id='l2h-167' xml:id='l2h-167'></a>. |
| 79 | </dd></dl> |
| 80 | |
| 81 | <P> |
| 82 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"><td><nobr>int <b><tt id='l2h-164' xml:id='l2h-164' class="cfunction">Py_AtExit</tt></b>(</nobr></td><td>void (*func) ())</td></tr></table></dt> |
| 83 | <dd> |
| 84 | Register a cleanup function to be called by |
| 85 | <tt class="cfunction">Py_Finalize()</tt><a id='l2h-168' xml:id='l2h-168'></a>. The cleanup |
| 86 | function will be called with no arguments and should return no |
| 87 | value. At most 32 <a id='l2h-169' xml:id='l2h-169'></a>cleanup functions can be |
| 88 | registered. When the registration is successful, |
| 89 | <tt class="cfunction">Py_AtExit()</tt> returns <code>0</code>; on failure, it returns |
| 90 | <code>-1</code>. The cleanup function registered last is called first. |
| 91 | Each cleanup function will be called at most once. Since Python's |
| 92 | internal finalization will have completed before the cleanup |
| 93 | function, no Python APIs should be called by <var>func</var>. |
| 94 | </dd></dl> |
| 95 | |
| 96 | <P> |
| 97 | |
| 98 | <DIV CLASS="navigation"> |
| 99 | <div class='online-navigation'> |
| 100 | <p></p><hr /> |
| 101 | <table align="center" width="100%" cellpadding="0" cellspacing="2"> |
| 102 | <tr> |
| 103 | <td class='online-navigation'><a rel="prev" title="5.1 Operating System Utilities" |
| 104 | href="os.html"><img src='../icons/previous.png' |
| 105 | border='0' height='32' alt='Previous Page' width='32' /></A></td> |
| 106 | <td class='online-navigation'><a rel="parent" title="5. Utilities" |
| 107 | href="utilities.html"><img src='../icons/up.png' |
| 108 | border='0' height='32' alt='Up One Level' width='32' /></A></td> |
| 109 | <td class='online-navigation'><a rel="next" title="5.3 Importing Modules" |
| 110 | href="importing.html"><img src='../icons/next.png' |
| 111 | border='0' height='32' alt='Next Page' width='32' /></A></td> |
| 112 | <td align="center" width="100%">Python/C API Reference Manual</td> |
| 113 | <td class='online-navigation'><a rel="contents" title="Table of Contents" |
| 114 | href="contents.html"><img src='../icons/contents.png' |
| 115 | border='0' height='32' alt='Contents' width='32' /></A></td> |
| 116 | <td class='online-navigation'><img src='../icons/blank.png' |
| 117 | border='0' height='32' alt='' width='32' /></td> |
| 118 | <td class='online-navigation'><a rel="index" title="Index" |
| 119 | href="genindex.html"><img src='../icons/index.png' |
| 120 | border='0' height='32' alt='Index' width='32' /></A></td> |
| 121 | </tr></table> |
| 122 | <div class='online-navigation'> |
| 123 | <b class="navlabel">Previous:</b> |
| 124 | <a class="sectref" rel="prev" href="os.html">5.1 Operating System Utilities</A> |
| 125 | <b class="navlabel">Up:</b> |
| 126 | <a class="sectref" rel="parent" href="utilities.html">5. Utilities</A> |
| 127 | <b class="navlabel">Next:</b> |
| 128 | <a class="sectref" rel="next" href="importing.html">5.3 Importing Modules</A> |
| 129 | </div> |
| 130 | </div> |
| 131 | <hr /> |
| 132 | <span class="release-info">Release 2.4.2, documentation updated on 28 September 2005.</span> |
| 133 | </DIV> |
| 134 | <!--End of Navigation Panel--> |
| 135 | <ADDRESS> |
| 136 | See <i><a href="about.html">About this document...</a></i> for information on suggesting changes. |
| 137 | </ADDRESS> |
| 138 | </BODY> |
| 139 | </HTML> |