File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ The :mod: `tkinter ` event loop running at the interactive prompt no longer
2+ polls on Unix if Tcl is threaded. It now waits for events or input, so the
3+ process does not wake up every few milliseconds while idle.
Original file line number Diff line number Diff line change @@ -3792,18 +3792,31 @@ EventHook(void)
37923792 else if (type == FILE_TYPE_DISK ) {
37933793 break ;
37943794 }
3795+ #else
3796+ if (tcl_lock == NULL ) {
3797+ /* Tcl is threaded and stdin is watched by MyFileProc, so we
3798+ can wait for an event or input instead of polling. */
3799+ Py_BEGIN_ALLOW_THREADS
3800+ tcl_tstate = tstate ;
3801+ result = Tcl_DoOneEvent (0 );
3802+ tcl_tstate = NULL ;
3803+ Py_END_ALLOW_THREADS
3804+ }
3805+ else
37953806#endif
3796- Py_BEGIN_ALLOW_THREADS
3797- if (tcl_lock )PyThread_acquire_lock (tcl_lock , 1 );
3798- tcl_tstate = tstate ;
3807+ {
3808+ Py_BEGIN_ALLOW_THREADS
3809+ if (tcl_lock )PyThread_acquire_lock (tcl_lock , 1 );
3810+ tcl_tstate = tstate ;
37993811
3800- result = Tcl_DoOneEvent (TCL_DONT_WAIT );
3812+ result = Tcl_DoOneEvent (TCL_DONT_WAIT );
38013813
3802- tcl_tstate = NULL ;
3803- if (tcl_lock )PyThread_release_lock (tcl_lock );
3804- if (result == 0 )
3805- Sleep (Tkinter_busywaitinterval );
3806- Py_END_ALLOW_THREADS
3814+ tcl_tstate = NULL ;
3815+ if (tcl_lock )PyThread_release_lock (tcl_lock );
3816+ if (result == 0 )
3817+ Sleep (Tkinter_busywaitinterval );
3818+ Py_END_ALLOW_THREADS
3819+ }
38073820
38083821 /* Report an exception raised in a callback, but keep pumping events
38093822 instead of returning to the prompt: without readline there is no
You can’t perform that action at this time.
0 commit comments