raul
raul

Reputation: 1269

Waiting for a thread to finish in python

The main thread in my program creates the UI. thread1 communicates with the server and thread2 writes the results to an Excel sheet. I want thread2 to start only after thread1 has finished executing. However, when I use thread1.join(), the UI goes irresponsive. How do I fix this? (Both thread1 and thread2 are created in the main thread.)

Upvotes: 0

Views: 190

Answers (1)

Thomas Orozco
Thomas Orozco

Reputation: 55197

You should call thread1.join() from within thread2's run method, so that's it's thread2 that waits on thread1, instead of the main thread.

Upvotes: 2

Related Questions