1<html lang="en"> 2<head> 3<title>getchar_unlocked - 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="up" href="Stdio.html#Stdio" title="Stdio"> 9<link rel="prev" href="getchar.html#getchar" title="getchar"> 10<link rel="next" href="getdelim.html#getdelim" title="getdelim"> 11<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage"> 12<meta http-equiv="Content-Style-Type" content="text/css"> 13<style type="text/css"><!-- 14 pre.display { font-family:inherit } 15 pre.format { font-family:inherit } 16 pre.smalldisplay { font-family:inherit; font-size:smaller } 17 pre.smallformat { font-family:inherit; font-size:smaller } 18 pre.smallexample { font-size:smaller } 19 pre.smalllisp { font-size:smaller } 20 span.sc { font-variant:small-caps } 21 span.roman { font-family:serif; font-weight:normal; } 22 span.sansserif { font-family:sans-serif; font-weight:normal; } 23--></style> 24<link rel="stylesheet" type="text/css" href="../cs.css"> 25</head> 26<body> 27<div class="node"> 28<a name="getchar_unlocked"></a> 29<a name="getchar_005funlocked"></a> 30<p> 31Next: <a rel="next" accesskey="n" href="getdelim.html#getdelim">getdelim</a>, 32Previous: <a rel="previous" accesskey="p" href="getchar.html#getchar">getchar</a>, 33Up: <a rel="up" accesskey="u" href="Stdio.html#Stdio">Stdio</a> 34<hr> 35</div> 36 37<h3 class="section">4.35 <code>getchar_unlocked</code>—non-thread-safe version of getchar (macro)</h3> 38 39<p><a name="index-getchar_005funlocked-221"></a><a name="index-g_t_005fgetchar_005funlocked_005fr-222"></a><strong>Synopsis</strong> 40<pre class="example"> #include <stdio.h> 41 int getchar_unlocked(); 42 43 #include <stdio.h> 44 int _getchar_unlocked_r(struct _reent *<var>ptr</var>); 45 46</pre> 47 <p><strong>Description</strong><br> 48<code>getchar_unlocked</code> is a non-thread-safe version of <code>getchar</code> 49declared in <code>stdio.h</code>. <code>getchar_unlocked</code> may only safely be used 50within a scope protected by flockfile() (or ftrylockfile()) and 51funlockfile(). These functions may safely be used in a multi-threaded 52program if and only if they are called while the invoking thread owns 53the ( FILE *) object, as is the case after a successful call to the 54flockfile() or ftrylockfile() functions. If threads are disabled, 55then <code>getchar_unlocked</code> is equivalent to <code>getchar</code>. 56 57 <p>The <code>_getchar_unlocked_r</code> function is simply the reentrant version of 58<code>getchar_unlocked</code> which passes an addtional reentrancy structure pointer 59argument: <var>ptr</var>. 60 61 <p><br> 62<strong>Returns</strong><br> 63See <code>getchar</code>. 64 65 <p><br> 66<strong>Portability</strong><br> 67POSIX 1003.1 requires <code>getchar_unlocked</code>. <code>getchar_unlocked</code> may 68be implemented as a macro. 69 70 <p>Supporting OS subroutines required: <code>close</code>, <code>fstat</code>, <code>isatty</code>, 71<code>lseek</code>, <code>read</code>, <code>sbrk</code>, <code>write</code>. 72<br> 73 74 </body></html> 75 76