Hello everyone,
Quick question: Are new threads created by a function tied to that function or are they independent as in the function that called them can end before the threads are finished?
Thanks
Hello everyone,
Quick question: Are new threads created by a function tied to that function or are they independent as in the function that called them can end before the threads are finished?
Thanks
Threads are independent OS-level objects, in terms of your question they are tied to process. So function can start one and don't wait until thread done.
There is no relationship between a function that starts a thread and the thread. However, if a function creates an object of some thread wrapper class type, it should either wait for the wrapped thread to end, or pass the object on somehow on function exit.