I have a dialog that does a certain operation in a thread. I create the thread upon pressing a button.
From the button handler I want to wait till the thread ends.
If I wait till the thread turns on a flag, the GUI is freeze.
What is the optimal way to do it ?

Thanks.