What is the best way to perform async tasks?

I have many time-consuming tasks and it’s so bad that UI is frozen during their execution. What is the best way to perform such tasks that do not need to interact with Sketchup UI? Do I need to build a separate service for the purpose?

The best answer considering the today’s date:

Show the Html dialog before your extensive operation starts, and close it after:

Hi There!
I’m working! Please be patient. In some case SketchUp UI may not respond for a while, so please leave me alone, do not move do not touch do not breathe!
After the operation done, this message will disappear and the UI will be yours again.

:beer:

What are these tasks? If it’s interacting with the SketchUp model then you cannot use threads since the API isn’t thread safe.

If you are doing calculations you have the possibility to to that in threads. But note that Ruby threads aren’t working well within SketchUp for some reason. Though native threads via Ruby C extensions will work fine.

Having some specific example of the type of work would help to provide a relevant rely.