aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDJ Delorie <dj@redhat.com>2005-04-26 01:02:02 +0000
committerDJ Delorie <dj@redhat.com>2005-04-26 01:02:02 +0000
commitc631edf1cc79aa305924c762642b9160cae94e2d (patch)
tree5bf2be7fe3b6c85b21ef2e65311cc9d85e7ed682 /libiberty/fopen_unlocked.c
parent*** empty log message *** (diff)
downloadbinutils-gdb-c631edf1cc79aa305924c762642b9160cae94e2d.tar.gz
binutils-gdb-c631edf1cc79aa305924c762642b9160cae94e2d.tar.bz2
binutils-gdb-c631edf1cc79aa305924c762642b9160cae94e2d.zip
merge from gcc
Diffstat (limited to 'libiberty/fopen_unlocked.c')
-rw-r--r--libiberty/fopen_unlocked.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/libiberty/fopen_unlocked.c b/libiberty/fopen_unlocked.c
index 8f9f300d101..84e3be54b28 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)
{