I am working on building an API for an application that already exists, which sometimes uses threads. So one on my methods is like this
private SSG theSSG;
...
private void doSomething(){
theSSG.loadMenu();
//my code
}
Now, the loadMenu
method could give birth to a thread, but not necessarily. If it does, doSomething
will execute the rest of the code, while the new thread is executing other code. What I need is a way to wait for the loadMenu()
to finish executing all of its children threads before perceeding to the next line of code. I do not have a reference of the thread that could possibly run, since that is based on the user's choice, so I can't use join()
. I also can't edit the application (or what happens in loadMenu
).