PR 5432: Thread safety patches

Benjamin Kosnik bkoz@redhat.com
Tue Jan 22 18:25:00 GMT 2002


> The sentry constructor has to block if another sentry object is bound 
> to the same stream, and then wake up when the destructor for the other 
> sentry object completes.   It has to be a counting mutex because some 
> operators << and >> use others underneath.

Ok. Thanks. I guess I'm now confused by "counting mutex." Is this a 
combination of the atomic operations for string and the gthr mutex bits 
(ie, pthreads)? Or is this just pthreads? Sorry in advance if I'm being 
dense.

If

  template<typename _CharT, typename _Traits>
    basic_ostream<_CharT, _Traits>::sentry::
    sentry(basic_ostream<_CharT,_Traits>& __os)
    : _M_ok(__os.good()), _M_os(__os)
    {
      // XXX MT 
      if (_M_ok && __os.tie())
	__os.tie()->flush();  
    }

is the sentry ctor, what did you have in mind?

-benjamin



More information about the Libstdc++ mailing list