Thread long processes from a plugin?

Hi,

I created a plugin to perform several operations on large datasets. Some operations, though, take a lot of so I tried execute them by means of a Thread. However this does not prevent the GUI to freeze. Is this an expected behaviour? Any ideas to solve this? I see we have workers now…could it be an option? The page on how to use is very concise, though, with no examples.

Always related to this. In order to update a progress bar I created a Timer which execute a method returning the amount of data processed. The idea was that during the long process I periodically read a static variable in the plugin which store the percentage of what done. The problem is that the Timer is not executed in parallel to the thread…Ideas on this as well?

Thanks,
Davide

Well, your plugin may need to call REALYieldToRB() regularly to let other threads in Xojo run.

Or maybe better you make a new thread to run your code in the C++ code.

Thank you Christian, yes I missed to call REALYieldToRB in the code. That could be an option. I don’t get your second suggestion though. Isn’t it what I have already done by calling the C++ code in a Thread in Xojo?

Thank you.

in the function called from Xojo, you can call REALYieldToRB often to yield time.
And you can of course make a thread in C++ code.