Author: sebor
Date: Thu Jan 10 18:03:25 2008
New Revision: 611019

URL: http://svn.apache.org/viewvc?rev=611019&view=rev
Log:
2008-01-10  Martin Sebor  <[EMAIL PROTECTED]>

        STDCXX-626
        * ostream.cc (flush): Implemeneted proposed resolution of LWG
        issue 581 and reverted the resolution of issue 60 wrt ostream
        ::flush().

Modified:
    incubator/stdcxx/trunk/include/ostream.cc

Modified: incubator/stdcxx/trunk/include/ostream.cc
URL: 
http://svn.apache.org/viewvc/incubator/stdcxx/trunk/include/ostream.cc?rev=611019&r1=611018&r2=611019&view=diff
==============================================================================
--- incubator/stdcxx/trunk/include/ostream.cc (original)
+++ incubator/stdcxx/trunk/include/ostream.cc Thu Jan 10 18:03:25 2008
@@ -22,7 +22,7 @@
  * implied.   See  the License  for  the  specific language  governing
  * permissions and limitations under the License.
  *
- * Copyright 1994-2006 Rogue Wave Software.
+ * Copyright 1994-2008 Rogue Wave Software, Inc.
  * 
  **************************************************************************/
 
@@ -35,19 +35,25 @@
 basic_ostream<_CharT, _Traits>::flush ()
 {
     if (this->rdbuf ()) {
-        _RWSTD_MT_GUARD (this->_C_bufmutex ());
 
-        int __res = 0;
+        // see LWG issue 581
 
-        _TRY {
-            __res = this->rdbuf ()->pubsync ();
-        }
-        _CATCH (...) {
-            this->setstate (ios_base::badbit | _RW::__rw_rethrow);
-        }
+        const sentry __opfx (*this);
+
+        if (__opfx) {
 
-        if (-1 == __res)
-            this->setstate (ios_base::badbit);
+            int __res = 0;
+
+            _TRY {
+                __res = this->rdbuf ()->pubsync ();
+            }
+            _CATCH (...) {
+                this->setstate (ios_base::badbit | _RW::__rw_rethrow);
+            }
+
+            if (-1 == __res)
+                this->setstate (ios_base::badbit);
+        }
     }
 
     return *this;


Reply via email to