Price your future right. 60% off with code BLACKSCHOLES at USD checkout. Offer ends in 8d 09h 54m 20s8 days 9 hours 54 minutes 20 seconds.
Price your future right. 60% off with code BLACKSCHOLES at USD checkout. Offer ends in 8d 09h 54m 20s8 days 9 hours 54 minutes 20 seconds.

Sign in to watch this lesson
Threads and Their Lifetimes · 4:17
The std::thread constructor copies its arguments, exactly as given, into the new thread's own storage and passes them on later as temporaries. Following C++ Concurrency in Action, we watch a pointer to a local buffer outlive its frame (caught by AddressSanitizer on a Mac), see why a reference parameter needs std::ref, and move a unique_ptr, and then std::thread itself, between owners, including the move that terminates the program.