Are containers with an extended interprocessor suitable for storing threads in the same process?

I need a vector container to be shared between two threads of the same process, providing secure access through mutex for the following methods:

empty size erase push_back 

I would also like the compiler to provide an iterator that locks the container while the iterator is in use. In fact, I am looking for a collection with the std::vector<...> interface, but with access protection at the same time, but I can not find anything.

Are boost::interprocess containers suitable for this application? If not, is there an alternative that is more suitable or do I need to write my own?

+4
source share
2 answers

The answer is that it fits. Look here

+2
source

If boost::interprocess containers do not work, you might want to check out Intel TBB . I started using it recently and was very pleased. In particular, check tbb::concurrent_vector .

+1
source

Source: https://habr.com/ru/post/1340954/


All Articles