Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4087590
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T18:52:27+00:00 2026-05-20T18:52:27+00:00

I would like a summary of what exactly is thread safe in C++ both

  • 0

I would like a summary of what exactly is thread safe in C++ both according to the current standard and C++0x as well as in practice (generally speaking, but also in my case with gcc 4.5.1).

For STL containers, my understanding is that thread safety is not guaranteed according to the current standard. Is it true though that in practice they are thread safe for single writer, multiple reader usage (on gcc and probably most modern compilers)? Is this guaranteed by C++11?.

What about POD types? I know that the standard guarantees nothing, but I’ve been told that in practice, all are thread safe for reading and writing. Of course even something simple like the increment operator may still need synchronization since there could be multiple reads and writes.

I’m primarily interested in the answers, but the why behind the answers would be appreciated to.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T18:52:28+00:00Added an answer on May 20, 2026 at 6:52 pm

    The current standard doesn’t mention threading at all, in any respect. In practice, the standard containers provide thread-safe reading, but require synchronization for writing.

    C++ 0x doesn’t talk much (at all?) specifically about containers with respect to thread safety/sharing, but does talk about assignments and such. In the end, it comes out pretty much the same though — even though the object is in a container, you’re reading/writing data, and you have to synchronize when/if at least one thread may modify the data.

    POD data doesn’t really change much: modifications will require synchronization as a general rule. There’s usually some subset of data types for which operations are normally atomic, but the members of that subset vary by platform. It’ll typically include types up to the native word size of the hardware allocated with “natural” alignment; anything else is open to a lot more question.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

in my members table i would like a summary of all different people in
I have an SQL Server 2000 db, and I would like to retrieve summary
I'm using jQuery validation in ASP.net MVC. I would like to show validation summary
I would like to parse the values from aspx pages, both what is passed
I'm trying to do this: $('.summary').css('top',$(this).outerHeight()); Where I reference 'this' I would like to
I would like to invoke heavy duty method dowork on a separate thread and
I would like to display the summary of validation in a validation summary with
I would like to create file upload with some fields for title and summary
I would like to format number displayed by <s:property value=summary.total/> tag in Struts 2.
I would like to know exactly what is going on with omp parallel for

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.