diff options
Diffstat (limited to 'lib/libc/stdio/putchar.c')
-rw-r--r-- | lib/libc/stdio/putchar.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/lib/libc/stdio/putchar.c b/lib/libc/stdio/putchar.c index 036b8970772c..5e04a6c72f2c 100644 --- a/lib/libc/stdio/putchar.c +++ b/lib/libc/stdio/putchar.c @@ -39,16 +39,29 @@ static char sccsid[] = "@(#)putchar.c 8.1 (Berkeley) 6/4/93"; #endif /* LIBC_SCCS and not lint */ #include <stdio.h> +#ifdef _THREAD_SAFE +#include <pthread.h> +#include "pthread_private.h" +#endif #undef putchar /* * A subroutine version of the macro putchar */ +int putchar(c) int c; { + int retval; register FILE *so = stdout; - return (__sputc(c, so)); +#ifdef _THREAD_SAFE + _thread_flockfile(so,__FILE__,__LINE__); +#endif + retval = __sputc(c, so); +#ifdef _THREAD_SAFE + _thread_funlockfile(so); +#endif + return (retval); } |