C ++ Security Summary

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

For STL containers, I understand that flow safety is not guaranteed in accordance with the current standard. Is it true that in practice they are thread safe for a single writer, using multiple readers (on gcc, and possibly on most modern compilers)? Is this guaranteed by C ++ 11 ?.

What about POD types? I know that the standard does not guarantee anything, but I was told that in practice they are all safe for reading and writing. Of course, even something as simple as an increment operator may still need to be synchronized, as there may be multiple reads and writes.

I am primarily interested in the answers, but why answers for the answers would be appreciated.

+5
source share
4 answers

The current standard does not mention the thread at all, anyway. In practice, standard containers provide thread-safe reads, but require synchronization to write.

++ 0x (?) / , .. , , - , / , , / .

POD : . , , . , "" ; .

+1

, , , .

, , , . , ++ , . , . ++ 0x, .

, , . , STL , . , , , , , .

POD . - 64- 32- . . , , , , .

+6

POD . , , .

++ 0x ; .

0

C, ++ concurrency, , (java) synchronised. ( ) - - , . Unix , .

(, Solaris) , , , pthread, ( , I/O, ) . Windows, OS/2 .

C/++ , , - . ++ , , . , , " - " C .

, , - .

0

All Articles