mirror of
https://github.com/isocpp/CppCoreGuidelines.git
synced 2024-03-22 13:30:58 +08:00
F.27: Example fix
It is usually a bad idea to share mutable objects between threads, which leads to a race condition or unnecessary thread contention.,
This commit is contained in:
parent
105ff97910
commit
5990abead1
|
@ -2583,7 +2583,7 @@ Using `std::shared_ptr` is the standard way to represent shared ownership. That
|
|||
|
||||
##### Example
|
||||
|
||||
shared_ptr<Image> im { read_image(somewhere) };
|
||||
shared_ptr<const Image> im { read_image(somewhere) };
|
||||
|
||||
std::thread t0 {shade, args0, top_left, im};
|
||||
std::thread t1 {shade, args1, top_right, im};
|
||||
|
|
Loading…
Reference in New Issue
Block a user