Boost logo

Boost :

Subject: Re: [boost] Proposal: Monotonic Containers - Comparison with boost::pool, boost::fast_pool and TBB
From: Simonson, Lucanus J (lucanus.j.simonson_at_[hidden])
Date: 2009-06-23 11:38:06


Steven Watanabe wrote:

>> Finally, you add a template parameter to monotonic to allow many
>> programmers working in the same application to declare their own
>> monotonic type that has separate buffers and lifetime from
>> eachother.
>
> This is better but still dangerous because any functions using this
> method will not be re-entrant.

This is a larger problem. The express motivation for the allocator is to provide fast, local storage for multiple threads to use without interacting with eachother. This is in contradiction with the need to rely on static data members in a standard compliant allocator. For multiple threads to use the allocator without interacting (we would prefer not to pay for locks if we aren't actually sharing information between threads) the allocator must differ by type. The only way that can be accomplished is if every thread calls a different function with a diferent instantiation of the allocator. We don't want to instantiate dozens of copies of the same functions at compile time to support many threads. This is why Christian was so keen to have non-static data in the allocator. I can't see any around the problem, this is one reason why tbb and others implement their own containers to support threading.

Luke


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