Is it safe to read global data from multiple threads?

Posted by user362515 on Stack Overflow See other posts from Stack Overflow or by user362515
Published on 2010-06-09T14:47:58Z Indexed on 2010/06/10 9:52 UTC
Read the original article Hit count: 115

Filed under:
|
|

The scenario is as follows:

  1. Create an instance of a class (std::map) and sore it as global variable.
  2. Spawn threads.
  3. Threads read and use the same global instance of the class
  4. All spawned threads quit
  5. Global class instance is destroyed

No mutex, no thread modifies the global class instance.

Is this OK?

Thank You

© Stack Overflow or respective owner

Related posts about c++

Related posts about multithreading