From 619b731f5bb5e09dcf1eaf1fbd96383ca64398fd Mon Sep 17 00:00:00 2001 From: julian Date: Mon, 22 Jan 1996 00:02:33 +0000 Subject: Reviewed by: julian and (hsu?) Submitted by: John Birrel(L?) changes for threadsafe operations --- lib/libc/stdio/fscanf.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'lib/libc/stdio/fscanf.c') diff --git a/lib/libc/stdio/fscanf.c b/lib/libc/stdio/fscanf.c index f0e726a..bbb3155 100644 --- a/lib/libc/stdio/fscanf.c +++ b/lib/libc/stdio/fscanf.c @@ -44,14 +44,20 @@ static char sccsid[] = "@(#)fscanf.c 8.1 (Berkeley) 6/4/93"; #else #include #endif +#ifdef _THREAD_SAFE +#include +#include "pthread_private.h" +#endif #if __STDC__ +int fscanf(FILE *fp, char const *fmt, ...) { int ret; va_list ap; va_start(ap, fmt); #else +int fscanf(fp, fmt, va_alist) FILE *fp; char *fmt; @@ -62,7 +68,13 @@ fscanf(fp, fmt, va_alist) va_start(ap); #endif +#ifdef _THREAD_SAFE + _thread_flockfile(fp,__FILE__,__LINE__); +#endif ret = __svfscanf(fp, fmt, ap); va_end(ap); +#ifdef _THREAD_SAFE + _thread_funlockfile(fp); +#endif return (ret); } -- cgit v1.1