Blender UI Multithreading Progressbar
The general mechanism to solve UI thread safety issues is to pass data from the worker thread to the main thread and then update the UI in the main thread using that data.

In this case you would create a modal operator that gets called regularly with a timer, see Text Editor &gt; Templates &gt; Python &gt; Operator Modal Timer for an example. Each time the operator modal function is called, you would check if the data has changed and update the UI accordingly.

How you pass the data between threads depends on the multithreading mechanism you are using. In Python there are a queue and multiprocessing.Queue modules that can be used with the threading and multiprocessing modules respectively. You put data in the queue in the worker thread and then get it out in the main thread.