Boost logo

Boost :

Subject: Re: [boost] [fusion] sequence io manipulators
From: Joel de Guzman (djowel_at_[hidden])
Date: 2013-03-25 21:33:57


On 3/26/13 3:12 AM, Jeff Flinn wrote:
> When streaming unrelated fusion sets to unrelated ostringstreams from different threads, I
> get an invalid iterator error. This appears to be due to using a
> boost::fusion::detail::stream_data::attach's local static arena instance.
>
> static void attach(Stream& stream, T const& data)
> {
> static arena ar; // our arena
> ar.data.push_back(new T(data));
> stream.pword(get_xalloc_index<Tag>()) = ar.data.back();
> }
>
> I assume there are issues with using the unguarded stream_data::data std::vector<T*> from
> multiple threads. This implementation looks problematic in that the arena data does not
> get cleaned up until program exit as well.

Right. That code is quite old, IIRC inherited from Boost.Tuples. Would you
care to provide a patch?

Regards,

-- 
Joel de Guzman
http://www.ciere.com
http://boost-spirit.com
http://www.cycfi.com/

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk