views:

44

answers:

1

How do you create an intrusive slist (boost) that is threadsafe so that multiple threads can remove items or add items?

I'd want fairly fine grained locking; so I can lock only the necessary nodes and not the whole list each time.

Do I just write a wrapper class around boost slist or is it better to just implement it myself?

+1  A: 

You can have a look at the approach here that uses C++0x atomic operations (if you have access to C++0x). It adresses the multi-producer/consumer approach.

http://www.drdobbs.com/high-performance-computing/210604448

David