This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

[PATCH] Fix libstdc++-v2 ends and endl


Hi!

In May opfx() was added to endl and ends, but opfx acquires the file lock,
so after the first time somebody calls endl or ends, other threads cannot
use that stream.
Ok to commit?

2000-10-18  Jakub Jelinek  <jakub@redhat.com>

	* iostream.cc (ends): Release the acquired lock.
	(endl): Likewise.

--- libio/iostream.cc.jj	Wed Oct 11 10:04:22 2000
+++ libio/iostream.cc	Wed Oct 18 17:18:34 2000
@@ -965,15 +965,25 @@ int istream::_skip_ws()
 
 ostream& ends(ostream& outs)
 {
-    if (outs.opfx())
+    if (outs.opfx()) {
+	_IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile,
+				  outs._strbuf);
 	outs.put('\0');
+	outs.osfx();
+	_IO_cleanup_region_end (0);
+    }
     return outs;
 }
 
 ostream& endl(ostream& outs)
 {
-    if (outs.opfx())
+    if (outs.opfx()) {
+	_IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile,
+				  outs._strbuf);
         flush(outs.put('\n'));
+	outs.osfx();
+	_IO_cleanup_region_end (0);
+    }
     return outs;
 }
 

	Jakub

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]