Intel® oneAPI Threading Building Blocks
Ask questions and share information about adding parallelism to your applications when using this threading library.

Contribution: Owning Container

AJ13
New Contributor I
260 Views
I have contributed another piece of YetiSim, the owning container. This container is used to store pointers to allocated objects, and the destructor will delete its held objects, and the user may delete objects from it themselves as well. The point of this class is to help enable exception safety in parallel code.

The ownership methods are wrapped with spin_mutex's. This construct isn't terribly TBB related, but it does use TBB mutexes and I found it useful in YetiSim where the performance of smart pointers was unacceptable, but I needed something to provide for exception safety, and parallel ownership giving/taking. It is available at http://code.google.com/p/tbbcommunity/

Note that this version is only useful for containers that support insert(), I usually find the version that uses vector more useful. I will be looking at doing a template specialization, or something and contribute that too.

AJ
0 Kudos
1 Reply
AJ13
New Contributor I
260 Views
It has been pointed out to me this is very similar to boost pointer container http://www.boost.org/libs/ptr_container/doc/ptr_container.html.

I didn't know about this earlier, however this contribution is still relevant because TBB mutexes are used. I will adjust this contribution to follow the convention of boost ptr container, and perhaps the API, however I will also add a template argument for the mutex type.

AJ
0 Kudos
Reply