1<html lang="en"> 2<head> 3<title>Reentrancy - Untitled</title> 4<meta http-equiv="Content-Type" content="text/html"> 5<meta name="description" content="Untitled"> 6<meta name="generator" content="makeinfo 4.13"> 7<link title="Top" rel="start" href="index.html#Top"> 8<link rel="prev" href="Math.html#Math" title="Math"> 9<link rel="next" href="Long-Double-Functions.html#Long-Double-Functions" title="Long Double Functions"> 10<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage"> 11<meta http-equiv="Content-Style-Type" content="text/css"> 12<style type="text/css"><!-- 13 pre.display { font-family:inherit } 14 pre.format { font-family:inherit } 15 pre.smalldisplay { font-family:inherit; font-size:smaller } 16 pre.smallformat { font-family:inherit; font-size:smaller } 17 pre.smallexample { font-size:smaller } 18 pre.smalllisp { font-size:smaller } 19 span.sc { font-variant:small-caps } 20 span.roman { font-family:serif; font-weight:normal; } 21 span.sansserif { font-family:sans-serif; font-weight:normal; } 22--></style> 23<link rel="stylesheet" type="text/css" href="../cs.css"> 24</head> 25<body> 26<div class="node"> 27<a name="Reentrancy"></a> 28<p> 29Next: <a rel="next" accesskey="n" href="Long-Double-Functions.html#Long-Double-Functions">Long Double Functions</a>, 30Previous: <a rel="previous" accesskey="p" href="Math.html#Math">Math</a>, 31Up: <a rel="up" accesskey="u" href="index.html#Top">Top</a> 32<hr> 33</div> 34 35<h2 class="chapter">2 Reentrancy Properties of <code>libm</code></h2> 36 37<p><a name="index-reentrancy-154"></a><a name="index-g_t_0040code_007bmatherr_007d-and-reentrancy-155"></a>When a libm function detects an exceptional case, <code>errno</code> may be 38set, the <code>matherr</code> function may be called, and a error message 39may be written to the standard error stream. This behavior may not 40be reentrant. 41 42<!-- The exact behavior depends on the currently selected error handling --> 43<!-- mode (IEEE, POSIX, X/Open, or SVID). --> 44 <p>With reentrant C libraries like the Red Hat newlib C library, <code>errno</code> is 45a macro which expands to the per-thread error value. This makes it thread 46safe. 47 48 <p>When the user provides his own <code>matherr</code> function it must be 49reentrant for the math library as a whole to be reentrant. 50 51 <p>In normal debugged programs, there are usually no math subroutine 52errors—and therefore no assignments to <code>errno</code> and no <code>matherr</code> 53calls; in that situation, the math functions behave reentrantly. 54 55 </body></html> 56 57