Terry J. Reedy <tjre...@udel.edu> added the comment:

Without thread support, event generation from multiple threads fails 
immediately.  I tried an experiment with callback scheduling.  It seems to work 
-- almost.

thread_event.py runs on 2.7 with non-t tcl.  It modifies TkinterHandlres32.py 
by replacing
            self.target.event_generate(c)
with
            self.target.after(1, lambda t=self.target: t.event_generate(c))
to schedule the event generation in the main thread.
It also imports either tkinter or Tkinter, and runs for 10 seconds
        self.root.after(10000,self.stop)
for a more rigorous test.

However, when I add 2 0s to the delay, to make it 1000 seconds, the main thread 
and gui crash sometime sooner (100 seconds, say), leaving the worker threads 
sending indefinitely.  One time there was a traceback:

Traceback (most recent call last):
  File "F:\dev\tem\thread_event.py", line 55, in <module>
    Main().go()
  File "F:\dev\tem\thread_event.py", line 35, in go
    self.t_cleanup.join()
AttributeError: 'Main' object has no attribute 't_cleanup'

A second time, nothing appeared.

I suspect that without proper locking an .after call was eventually interrupted 
and the pending scheduled callback data structure corrupted. Mainloop exits 
without t_cleanup created.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue33412>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to