Reputation: 2067
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
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
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
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