Lifetime Issues of Variables

This lesson explains challenges related to lifetime issues of variables in C++.

Creating a C++ example with lifetime related issues is quite easy. Let the created thread t run in the background (i.e. it was detached with a call to t.detach()) and let it be only half completed; the creator thread will not wait until its child is done. In this case, you have to be extremely careful not to use anything in the child thread that belongs to the creator thread.

Get hands-on with 1000+ tech skills courses.