Am 18.11.2010 23:02, schrieb Gennadiy Rozental:
Hi,

I've got a following problem:

I need to maintain actively used shared counter in MT environment. I need usual
increment and decrement operations with increment value of 1 plus I also need
sometimes to operate with large increment value (like 1000, 10000). 

I'd like to make handling of this counter as fast as possible and would like to
use atomic_counter used inside of boost::shared_ptr, but I can't seem be able to
find a way to effectively/correctly implement "massive" increments with it.

Any recommendations,

Thank you.

Gennadiy

Hi,

you can easily do this using Boost.Atomic and intrusive_ptr:
http://www.chaoticmind.net/~hcb/projects/boost.atomic/doc/atomic/usage_examples.html#boost_atomic.usage_examples.example_reference_counters

It should be easy to make (un-)reference and counter-operations atomic using this ;)

Regards,

michi7x7