Boost logo

Boost :

From: John Maddock (john_at_[hidden])
Date: 2006-08-31 09:03:10

Caleb Epstein wrote:
> On 8/31/06, John Maddock <john_at_[hidden]> wrote:
>> In any case all the implementations I'm aware of are minimally
>> thread safe these days, if that's not the case I'd certainly like to
>> hear about it. BTW implementations that used copy-on-write in the
>> early days almost all (all?) switched away from that precisely
>> because of threading issues.
> Even the latest libstdc++ (GNU's Standard C++ library) uses a
> refcounted std::string.

Darn, I hadn't realised that :-(

> One needs to be careful when sharing strings across thread boundaries.
> See these bug reports for a detailed discussion:

Very interesting stuff!

I'm not sure that it's relevent in this case though: if you're
lexical_cast'ing *to* a string then these issues shouldn't arise, whether
there are other threads getting involved or not. If you're casting *from* a
string, then it appears that you need a mutex if you know the string is
likely to be visible to other threads, even if all accesses to it are

Have I got that right?

Thanks, John.

Boost list run by bdawes at, gregod at, cpdaniel at, john at