This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author terry.reedy
Recipients Ivan.Pozdeev, serhiy.storchaka, terry.reedy
Date 2018-05-06.19:20:11
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1525634411.81.0.682650639539.issue33412@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2018-05-06 19:20:11terry.reedysetrecipients: + terry.reedy, serhiy.storchaka, Ivan.Pozdeev
2018-05-06 19:20:11terry.reedysetmessageid: <1525634411.81.0.682650639539.issue33412@psf.upfronthosting.co.za>
2018-05-06 19:20:11terry.reedylinkissue33412 messages
2018-05-06 19:20:11terry.reedycreate