diff options
author | DJ Delorie <dj@redhat.com> | 2005-04-26 01:02:02 +0000 |
---|---|---|
committer | DJ Delorie <dj@redhat.com> | 2005-04-26 01:02:02 +0000 |
commit | c631edf1cc79aa305924c762642b9160cae94e2d (patch) | |
tree | 5bf2be7fe3b6c85b21ef2e65311cc9d85e7ed682 /libiberty/fopen_unlocked.c | |
parent | 306ab1664beeadd87a5f848a45c44ecf4b18d180 (diff) | |
download | gdb-c631edf1cc79aa305924c762642b9160cae94e2d.zip gdb-c631edf1cc79aa305924c762642b9160cae94e2d.tar.gz gdb-c631edf1cc79aa305924c762642b9160cae94e2d.tar.bz2 |
merge from gcc
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) { |