The problem is that the thread goes out of scope without having been joined, so the program crashes. See
here[
^]
Assuming that this did work, you would get a crash anyway, since you have an infinite loop. Eventually you would run out of resources to create more threads. Maybe this is just a short demo to show what you are up against?