Lifetime Issues of Variables
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.