Vijay
Vijay

Reputation: 2067

C++ Need thread safe wel tested containers (non microsoft)

Any one having idea about thread safe data containers like queue, map? I dont want threadsafe STL when we use /MT switches for compiler.

A real thread safe wel tested STL containers.

Upvotes: 2

Views: 807

Answers (4)

Blastfurnace
Blastfurnace

Reputation: 18652

The Microsoft Parallel Patterns Library (PPL) includes concurrent_vector and concurrent_queue and they added concurrent versions of unordered_map, unordered_multimap, unordered_set, and unordered_multiset to the Concurrency Runtime sample pack v0.33 and newer.

Upvotes: 0

uray
uray

Reputation: 11572

/MT imply you want to link to multithreaded runtime library (which is compatible to multithreaded application), but it does not make the runtime library is thread safe.

Upvotes: 1

Yakov Galka
Yakov Galka

Reputation: 72509

Thread safe containers usually make no sense. Consider a 'thread-safe` queue:

if(!qu.empty())
{
    // 1
    qu.pop();
}

What if during #1 the queue is modified and it becomes empty? It breaks the code. This is why you should use locks in your code rather than 'thread-safe' containers.

Upvotes: 9

Björn Pollex
Björn Pollex

Reputation: 76838

Intel TBB is specifically designed for this.

Upvotes: 1

Related Questions