summaryrefslogtreecommitdiff
path: root/lib/libc/stdio/putchar.c
diff options
context:
space:
mode:
authorJordan K. Hubbard <jkh@FreeBSD.org>1996-06-03 05:12:29 +0000
committerJordan K. Hubbard <jkh@FreeBSD.org>1996-06-03 05:12:29 +0000
commitaccd7f182e87d2a1d578214211ee7ded32753803 (patch)
tree90de65019704d8a469505b67d00c11e813d480e0 /lib/libc/stdio/putchar.c
parentc3287ad65e82f73d993c7537d1fc5a7a16199449 (diff)
Notes
Diffstat (limited to 'lib/libc/stdio/putchar.c')
-rw-r--r--lib/libc/stdio/putchar.c15
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);
}