aboutsummaryrefslogtreecommitdiff
path: root/libio
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2001-11-28 23:35:29 +0000
committerUlrich Drepper <drepper@redhat.com>2001-11-28 23:35:29 +0000
commitc6baa867d3d57ca3eb89226b44ad696960d869cd (patch)
tree65612b8dabc1e9d2b0f957290c8076eae741d895 /libio
parentcf6a2367e82ba5b322baf0fc0caa5d57e799c72d (diff)
downloadglibc-c6baa867d3d57ca3eb89226b44ad696960d869cd.tar
glibc-c6baa867d3d57ca3eb89226b44ad696960d869cd.tar.gz
glibc-c6baa867d3d57ca3eb89226b44ad696960d869cd.tar.bz2
glibc-c6baa867d3d57ca3eb89226b44ad696960d869cd.zip
Update.
2001-11-28 Ulrich Drepper <drepper@redhat.com> * libio/genops.c (_IO_flush_all_lockp): New function. The same code as the old _IO_flush_all but lock only if parameter is nonzero. (_IO_flush_all): Call _IO_flush_all_lockp with 1 as parameter. * libio/libioP.h: Add prototype for _IO_flush_all_lockp. * sysdeps/generic/abort.c (fflush): Define to _IO_flush_all_lockp(0) if libio is used.
Diffstat (limited to 'libio')
-rw-r--r--libio/genops.c22
-rw-r--r--libio/libioP.h3
2 files changed, 19 insertions, 6 deletions
diff --git a/libio/genops.c b/libio/genops.c
index d786ebca57..2398cff684 100644
--- a/libio/genops.c
+++ b/libio/genops.c
@@ -784,7 +784,7 @@ _IO_get_column (fp)
int
-_IO_flush_all ()
+_IO_flush_all_lockp (int do_lock)
{
int result = 0;
struct _IO_FILE *fp;
@@ -792,7 +792,8 @@ _IO_flush_all ()
#ifdef _IO_MTSAFE_IO
_IO_cleanup_region_start_noarg (flush_cleanup);
- _IO_lock_lock (list_all_lock);
+ if (do_lock)
+ _IO_lock_lock (list_all_lock);
#endif
last_stamp = _IO_list_all_stamp;
@@ -800,7 +801,8 @@ _IO_flush_all ()
while (fp != NULL)
{
run_fp = fp;
- _IO_flockfile (fp);
+ if (do_lock)
+ _IO_flockfile (fp);
if (((fp->_mode <= 0 && fp->_IO_write_ptr > fp->_IO_write_base)
#if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T
@@ -812,7 +814,8 @@ _IO_flush_all ()
&& _IO_OVERFLOW (fp, EOF) == EOF)
result = EOF;
- _IO_funlockfile (fp);
+ if (do_lock)
+ _IO_funlockfile (fp);
run_fp = NULL;
if (last_stamp != _IO_list_all_stamp)
@@ -826,13 +829,22 @@ _IO_flush_all ()
}
#ifdef _IO_MTSAFE_IO
- _IO_lock_unlock (list_all_lock);
+ if (do_lock)
+ _IO_lock_unlock (list_all_lock);
_IO_cleanup_region_end (0);
#endif
return result;
}
+
+int
+_IO_flush_all ()
+{
+ /* We want locking. */
+ return _IO_flush_all_lockp (1);
+}
+
void
_IO_flush_all_linebuffered ()
{
diff --git a/libio/libioP.h b/libio/libioP.h
index 9a336fb0cb..3a32caa8b6 100644
--- a/libio/libioP.h
+++ b/libio/libioP.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1993, 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
+/* Copyright (C) 1993,1997,1998,1999,2000,2001 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -426,6 +426,7 @@ extern int _IO_do_write __P ((_IO_FILE *, const char *, _IO_size_t));
extern int _IO_new_do_write __P ((_IO_FILE *, const char *, _IO_size_t));
extern int _IO_old_do_write __P ((_IO_FILE *, const char *, _IO_size_t));
extern int _IO_wdo_write __P ((_IO_FILE *, const wchar_t *, _IO_size_t));
+extern int _IO_flush_all_lockp __P ((int));
extern int _IO_flush_all __P ((void));
extern int _IO_cleanup __P ((void));
extern void _IO_flush_all_linebuffered __P ((void));