microblaze: sync sysdep-cancel.h/sydep.h with GNU libc
[uclibc-ng.git] / libc / stdio / putchar.c
blob583e90f44967c7299ccf07b6b07a6f38e59cfc3f
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.
6 */
8 #include "_stdio.h"
11 #undef putchar
12 #ifdef __DO_UNLOCKED
14 #undef putchar_unlocked
15 int putchar_unlocked(int c)
17 register FILE *stream = stdout;
19 return __PUTC_UNLOCKED_MACRO(c, stream);
22 #ifndef __UCLIBC_HAS_THREADS__
23 strong_alias(putchar_unlocked,putchar)
24 #endif
26 #elif defined __UCLIBC_HAS_THREADS__
28 int putchar(int c)
30 register FILE *stream = stdout;
32 if (stream->__user_locking != 0) {
33 return __PUTC_UNLOCKED_MACRO(c, stream);
34 } else {
35 int retval;
36 __STDIO_ALWAYS_THREADLOCK(stream);
37 retval = __PUTC_UNLOCKED_MACRO(c, stream);
38 __STDIO_ALWAYS_THREADUNLOCK(stream);
39 return retval;
43 #endif