This is the mail archive of the
libstdc++@sourceware.cygnus.com
mailing list for the libstdc++ project.
Re: MT string, second try
On Thu, Mar 16, 2000 at 05:19:45PM -0800, Benjamin Kosnik wrote:
> some typos:
>
> > _M_grab(const _Alloc& __alloc1, const _Alloc& __alloc2)
> > - { return (_M_state >= 0 && __alloc1 == __alloc2) ?
> > + { return (!_M_leaked() && __alloc1 == __alloc2) ?
> > _M_refcopy() : _M_clone(__alloc1); }
>
> no _M_leaked() MF.
>
> Assuming you mean
>
> _M_is_leaked()
Right, sorry.
> > void
> > _M_leak() // for use in begin() & non-const op[]
> > {
> > - if (_M_rep()->_M_state >= 0)
> > + if (!_M_rep()->_M_leaked())
> > _M_leak_hard();
> > }
>
> same here
> and then here...
>
> template<typename _CharT, typename _Traits, typename _Alloc>
> void
> basic_string<_CharT, _Traits, _Alloc>::_M_leak_hard()
> {
> if (_M_rep()->_M_is_shared())
> _M_mutate(0, 0, 0);
> + _M_rep()->_M_set_leaked();
> - _M_rep()->set_leaked();
> }
Right, sorry.
> Also, there are bunches of places in the string code where I see stuff like
>
> // XXX MT
>
> if this code is not MT-safe, can that stuf be cleaned up please? Or
> explained...
I have looked at them. Not to worry.
> with these changes, it compiles on x86/linux. If they are correct, let me
> know and I'll check in.
I have coming up a detailed explanation of what we have to do with the
build system.
> Perhaps then it can be tested? Does anybody have
> tests....
Nathan Myers
ncm@nospam.cantrip.org