diff options
author | Kaveh R. Ghazi <ghazi@caip.rutgers.edu> | 2005-04-26 00:14:35 +0000 |
---|---|---|
committer | Kaveh Ghazi <ghazi@gcc.gnu.org> | 2005-04-26 00:14:35 +0000 |
commit | 32e82bd8960ae9065a5003edb15665a244b6bf1a (patch) | |
tree | f51981e350ce82938172a24c2eac8c527d04158f /libiberty/fopen_unlocked.c | |
parent | c2cab3e97ae95a873e8c8e8501b4196b653749e5 (diff) | |
download | gcc-32e82bd8960ae9065a5003edb15665a244b6bf1a.zip gcc-32e82bd8960ae9065a5003edb15665a244b6bf1a.tar.gz gcc-32e82bd8960ae9065a5003edb15665a244b6bf1a.tar.bz2 |
libiberty.h (unlock_std_streams): New.
include:
* libiberty.h (unlock_std_streams): New.
libiberty:
* fopen_unlocked.c (unlock_std_streams): New.
* functions.texi: Regenerate.
From-SVN: r98746
Diffstat (limited to 'libiberty/fopen_unlocked.c')
-rw-r--r-- | libiberty/fopen_unlocked.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/libiberty/fopen_unlocked.c b/libiberty/fopen_unlocked.c index 8f9f300..84e3be5 100644 --- a/libiberty/fopen_unlocked.c +++ b/libiberty/fopen_unlocked.c @@ -28,6 +28,14 @@ pointer unchanged. If the @var{stream} is @code{NULL} do nothing. @end deftypefn +@deftypefn Extension void unlock_std_streams (void) + +If the OS supports it, ensure that the standard I/O streams, +@code{stdin}, @code{stdout} and @code{stderr} are setup to avoid any +multi-threaded locking. Otherwise do nothing. + +@end deftypefn + @deftypefn Extension FILE * fopen_unlocked (const char *@var{path}, const char * @var{mode}) Opens and returns a @code{FILE} pointer via @code{fopen}. If the @@ -80,11 +88,19 @@ unlock_1 (FILE *const fp ATTRIBUTE_UNUSED) } void -unlock_stream(FILE *fp) +unlock_stream (FILE *fp) { unlock_1 (fp); } +void +unlock_std_streams (void) +{ + unlock_1 (stdin); + unlock_1 (stdout); + unlock_1 (stderr); +} + FILE * fopen_unlocked (const char *path, const char *mode) { |