Fix F.27 example, closes #2171
parent
41426a1a5f
commit
e44d35b55c
|
@ -3605,6 +3605,7 @@ Using `std::shared_ptr` is the standard way to represent shared ownership. That
|
|||
|
||||
##### Example
|
||||
|
||||
{
|
||||
shared_ptr<const Image> im { read_image(somewhere) };
|
||||
|
||||
std::thread t0 {shade, args0, top_left, im};
|
||||
|
@ -3612,8 +3613,11 @@ Using `std::shared_ptr` is the standard way to represent shared ownership. That
|
|||
std::thread t2 {shade, args2, bottom_left, im};
|
||||
std::thread t3 {shade, args3, bottom_right, im};
|
||||
|
||||
// detach threads
|
||||
// last thread to finish deletes the image
|
||||
// detaching threads requires extra care (e.g., to join
|
||||
// before main ends), but even if we do detach t0..3 here ...
|
||||
}
|
||||
// ... shared_ptr ensures that eventually the last thread to
|
||||
// finish safely deletes the image
|
||||
|
||||
##### Note
|
||||
|
||||
|
|
Loading…
Reference in New Issue