Query regarding thread safety of few libc stdio functions

From: Mayank Kumar <mayank_at_microsoft.com>
Date: Mon, 25 Apr 2005 21:19:12 +0800
Hi All
Recently I have been looking at few freebsd libc functions and I found
That they were not thread safe. Can one of you please confirm.

Following functions in freebsd libc are not thread safe:-
1: vsnprintf
2: vsprintf
3: vsscanf
 theere are many more.

Functions like vfprintf are written as follows:-
-------------
int ret;

	FLOCKFILE(fp);
	ret = __vfprintf(fp, fmt0, ap);
	FUNLOCKFILE(fp);
	return (ret);
----------------
Which ensures that they are thread safe.

Why is the same case not followed for eg with vsnprintf or vsprintf
Vsnprintf calls directly __vfprintf which is not thread safe. Hence
How is there thready safey guranteed. Any help on this front
Would be helpful.

Thanks and regards
Mayank
Received on Mon Apr 25 2005 - 11:24:12 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:38:32 UTC