If I understand correctly (which I am not sure) you want to be able to interact with the rest of your application except for the button that launched the new thread. If this is the case, you should disable the button when you create the thread, remove the while loop and reenable the button when the thread has finished.