Thread safety

https://en.wikipedia.org/wiki/Thread_safety

Thread safety is a computer programming concept applicable in the context of multithreaded programs. A piece of code is thread-safe if it manipulates shared data structures only in a manner that guarantees safe execution by multiple threads at the same time. There are various strategies for making thread-safe data structures.[1][2]

A program may execute code in several threads simultaneously in a shared address space where each of those threads has access to virtually all of the memory of every other thread. Thread safety is a property that allows code to run in multithreaded environments by re-establishing some of the correspondences between the actual flow of control and the text of the program, by means of synchronization.

原文地址:https://www.cnblogs.com/rsapaper/p/6065199.html