Custom OpenGL renderer UI lock

I am implementing an OpenGL based rendering engine and came up with a little inconvenience, that the blender UI gets frozen when rendering. As a side effect, this does not allow me to show actual progress of the rendering. So I wonder if this is a bug or an expected behavior as maybe OpenGL interfere with blender’s UI rendering somehow?
Just to demonstrate here’s a little script that you can run.

import bpy
import time

class CustomRenderEngine(bpy.types.RenderEngine):
    bl_idname = 'CustomRenderEngine'
    bl_label = 'Progress Bar Bug'
    bl_use_gpu_context = True

    def render(self, scene):
        for i in range(100):
            self.update_progress(float(i) / 100.)


And if you set bl_use_gpu_context = False you will see the render progress bar when invoking render with F12 for example. If you leave bl_use_gpu_context = True the UI freezes during render.

A small update. In case bl_use_gpu_context = True the UI freezes after any input from the user, e.g. rotating the camera

Most of the UI in blender is drawn by python which can’t run while your render method which is also python is running.

Does it mean that there’s no intended way of doing it? As I don’t really want hacky workarounds, it would mean that I should abandon the idea of having progress bar for my renderer.

I was thinking about doing same thing for my batch render addon for work and as far as I can tell, you should be able to show render progress by creating new thread and render new window independently from main process while it frozen. I haven’t had time to check it for my own, but maybe it’ll help you. Also, there’re a few gotchas with creating new thread (you need to join it with main thread, I think I’ve read it in docs).
For now I just open up a console and just print progress there