Open mdickinson opened 3 years ago
The example also shows potentially simultaneous updates to the self.counters
list from multiple threads, which isn't ideal.
I'm able to reproduce this behavior on windows with pyqt5
The other multithreading demo, https://github.com/enthought/traitsui/blob/7f246271c7fc54212d0e9609db65baf1d7f603b5/traitsui/examples/demo/Advanced/Multi_thread_demo.py, has similar issues. Threads are never joined, and there's a classic race condition in updating self.running
.
I think we should just consider removing both multi thread demo examples
The
Multi_thread_demo_2.py
demo script hangs at exit, when started from the command line.Steps to reproduce (on macOS):
traitsui
andpyside2
into a fresh EDM Python 3.6 environmentpython Multi_thread_demo_2.py
from a Terminal windowAt this point, control doesn't return to the shell prompt until Ctrl-C is pressed, interrupting the Python process with a
KeyboardInterrupt
.This might be a good place to show good practices in terms of keeping track of, and eventually joining, threads.