Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

Is STL considered thread safe??

safe STL thread
0
Posted

Is STL considered thread safe??

0

This should probably be a FAQ entry. Here’s the answer I gave 2 months ago to a similar question: In general, the desired behavior is that it’s up to you to make your explicit operations on containers, iterators, etc thread safe. This is good because you might have several containers all synchronized using the same locking construct, so if the implementation used individual locks underneath it would be both wrong and expensive. On the other hand, implicit operations on the containers should be thread safe since you can’t control them. Typically these involve memory allocation. Some versions of the STL follow these guidelines. Look at the design notes at http://www.sgi.com/Technology/STL/thread_safety.html Jeff ——— There is not such thing as *the* STL library. It is an abstract interface defined in the C++ standard. There is no mention of threads in the C++ standard, so the STL is not required to be thread safe. To find out whether your local implementation of the STL is thread sa

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.

Experts123