Hi,
is there anywhere I can find an example of how to run a function asynchronously? I need to update a message being displayed on the screen while some processes are running but I cannot find any example anywhere.
Thanks in advance
Hi,
is there anywhere I can find an example of how to run a function asynchronously? I need to update a message being displayed on the screen while some processes are running but I cannot find any example anywhere.
Thanks in advance
You could simply use the static function MessageManager::callAsync with a lambda, but you have to be very careful that the involved objects do not get destroyed before the lambda gets a chance to get executed.
MessageManager::callAsync([&]()
{
message.set("Writing file...");
repaint();
});
Something like this?
It gets executed at the end of the calling function anyway
Well, it obviously doesn’t help if your processing/calculations happen in the GUI thread…(There really isn’t any clean and easy solution for that. You will have to change your processing to happen in another thread to be able to get GUI updates.)
Ok, thanks!
I wanted to link a great talk at the last JUCE meetup about that topic about 2 weeks ago, but googling to Dave Rowland… too many country songs on youtube
You can find the video to that talk here… https://skillsmatter.com/skillscasts/11632-audio-developers-meet-up-april
and the corresponding repo here… https://github.com/drowaudio/presentations/tree/master/Audio%20Developer%20Meetup%20April%202018
I am absolute newbie with async functions. I try to understand AsyncUpdater
. Looking for examples and background theory if it’s available.