[SOLVED] Gui host freeze when using the "system" command

gui

#1

Hi,

I’ve developed a little plugin that call a bash script with the C system command.
When the bash script run, it freezes the GUI host.
I use this async function to load it :
Call async method

Does anyone know why it acts like this ?

Thank !


#2

You are still running your command on the UI thread. The async method you are using just defers the processing but the processing will still be done on the UI thread. You create a new thread and then execute the command on the new thread. You could do the following for example:

Thread::launch ([] { std::system ("shell_command_that_takes_a_really_long_time"); });

#3

Thank you Fabian, it works !
I supposed that the plugin should have its own thread, not interfering with the host GUI, but it’s doesn’t seem to work like that.

Have a nice day,
Kyrillos