1 /* Copyright (C) 2004 Manuel Novoa III <mjn3@codepoet.org>
3 * GNU Library General Public License (LGPL) version 2 or later.
5 * Dedicated to Toni. See uClibc/DEDICATION.mjn3 for details.
10 /* libc_hidden_proto(__fgetc_unlocked) */
15 /* the only use of the hidden getchar_unlocked is in gets.c */
16 #undef getchar_unlocked
17 /* libc_hidden_proto(getchar_unlocked) */
18 int getchar_unlocked(void)
20 register FILE *stream = stdin;
22 return __GETC_UNLOCKED_MACRO(stream);
24 libc_hidden_def(getchar_unlocked)
26 #ifndef __UCLIBC_HAS_THREADS__
27 strong_alias(getchar_unlocked,getchar)
30 #elif defined __UCLIBC_HAS_THREADS__
34 register FILE *stream = stdin;
36 if (stream->__user_locking != 0) {
37 return __GETC_UNLOCKED_MACRO(stream);
40 __STDIO_ALWAYS_THREADLOCK(stream);
41 retval = __GETC_UNLOCKED_MACRO(stream);
42 __STDIO_ALWAYS_THREADUNLOCK(stream);