1<html lang="en"> 2<head> 3<title>getc_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="getc.html#getc" title="getc"> 10<link rel="next" href="getchar.html#getchar" title="getchar"> 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="getc_unlocked"></a> 29<a name="getc_005funlocked"></a> 30<p> 31Next: <a rel="next" accesskey="n" href="getchar.html#getchar">getchar</a>, 32Previous: <a rel="previous" accesskey="p" href="getc.html#getc">getc</a>, 33Up: <a rel="up" accesskey="u" href="Stdio.html#Stdio">Stdio</a> 34<hr> 35</div> 36 37<h3 class="section">4.33 <code>getc_unlocked</code>—non-thread-safe version of getc (macro)</h3> 38 39<p><a name="index-getc_005funlocked-217"></a><a name="index-g_t_005fgetc_005funlocked_005fr-218"></a><strong>Synopsis</strong> 40<pre class="example"> #include <stdio.h> 41 int getc_unlocked(FILE *<var>fp</var>); 42 43 #include <stdio.h> 44 int _getc_unlocked_r(FILE *<var>fp</var>); 45 46</pre> 47 <p><strong>Description</strong><br> 48<code>getc_unlocked</code> is a non-thread-safe version of <code>getc</code> declared in 49<code>stdio.h</code>. <code>getc_unlocked</code> may only safely be used within a scope 50protected by flockfile() (or ftrylockfile()) and funlockfile(). These 51functions may safely be used in a multi-threaded program if and only 52if they are called while the invoking thread owns the ( FILE *) 53object, as is the case after a successful call to the flockfile() or 54ftrylockfile() functions. If threads are disabled, then 55<code>getc_unlocked</code> is equivalent to <code>getc</code>. 56 57 <p>The <code>_getc_unlocked_r</code> function is simply the reentrant version of 58<code>get_unlocked</code> which passes an additional reentrancy structure pointer 59argument: <var>ptr</var>. 60 61 <p><br> 62<strong>Returns</strong><br> 63See <code>getc</code>. 64 65 <p><br> 66<strong>Portability</strong><br> 67POSIX 1003.1 requires <code>getc_unlocked</code>. <code>getc_unlocked</code> may be 68implemented as a macro, so arguments should not have side-effects. 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