1. What is thread safety?
When multithreading accesses a class or a resource, the class or resource can show the following characteristicsRight behaviorSo this is thread safety
2. What is thread safe class?
When a multithread accesses a class, no matter what scheduling mode the running environment adopts or how these threads execute alternately, and no additional synchronization or collaboration is required in the main calling code, the class can show correct behavior, so the class is called thread safe
The necessary synchronization mechanism is encapsulated in the thread safe class, so the caller does not need to take further measures
This work adoptsCC agreementReprint must indicate the author and the link of this article