asyncUpdater example


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.

     message.set("Writing file...");


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.)

Have a look at ThreadPoolJob or TimeSliceThread to do the work in the background.


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 :wink:


You can find the video to that talk here…

and the corresponding repo here…


I am absolute newbie with async functions. I try to understand AsyncUpdater. Looking for examples and background theory if it’s available.

1 Like