summaryrefslogtreecommitdiffstats
path: root/lib/libc/stdio/putc.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libc/stdio/putc.c')
-rw-r--r--lib/libc/stdio/putc.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/lib/libc/stdio/putc.c b/lib/libc/stdio/putc.c
index c18353b..f1d42b1 100644
--- a/lib/libc/stdio/putc.c
+++ b/lib/libc/stdio/putc.c
@@ -39,15 +39,28 @@ static char sccsid[] = "@(#)putc.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
/*
* A subroutine version of the macro putc.
*/
#undef putc
+int
putc(c, fp)
int c;
register FILE *fp;
{
- return (__sputc(c, fp));
+ int retval;
+#ifdef _THREAD_SAFE
+ _thread_flockfile(fp,__FILE__,__LINE__);
+#endif
+ retval = __sputc(c, fp);
+#ifdef _THREAD_SAFE
+ _thread_funlockfile(fp);
+#endif
+ return (retval);
}
OpenPOWER on IntegriCloud