Callback when thread is done?


#1

After a thread objects run() function is completed can I get a callback on the main thread?  I am trying to do splash screen and the JUCE docs say to do


void MyApp::initialise (const String& commandLine)
{
splash = new SplashScreen ("Welcome to my app!",
ImageFileFormat::loadFrom (File ("/foobar/splash.jpg")),
true);
// now kick off your initialisation work on some kind of thread or task, and
launchBackgroundInitialisationThread();
}
void MyApp::myInitialisationWorkFinished()
{
// ..assuming this is some kind of callback method that is triggered when
// your background initialisation threads have finished, and it's time to open
// your main window, etc..
splash->deleteAfterDelay (RelativeTime::seconds (4), false);
...etc...
}

 

But I dont see a way to trigger a callback after the thread is done?


#2

Sure, if you trigger one. Maybe use an AsyncUpdater or callAsync