Add an optional hack for threads in Tkinter.
This one works! However it requires using a modified version of
tclNotify.c (provided), which requires access to the Tcl source
to compile it. In order to enable this hack, add the following
to the Setup line for _tkinter:
tclNotify.c -DHAVE_PYTCL_WAITUNTILEVENT -I$(TCL)/generic
where TCL points to the source tree of Tcl 8.0. Other versions
of Tcl are not supported.
The tclNotify.c file is copyrighted by Sun Microsystems; the
licensing terms are in the file license.terms. According to this
file, no further permission to distribute this is required,
provided the file license.terms is included. Hence, I am checking
that in, too.
diff --git a/Modules/_tkinter.c b/Modules/_tkinter.c
index 04150d1..1307053 100644
--- a/Modules/_tkinter.c
+++ b/Modules/_tkinter.c
@@ -1265,7 +1265,7 @@
!errorInCmd)
{
int result;
-#ifdef THIS_CODE_IS_BUGGY
+#ifdef HAVE_PYTCL_WAITUNTILEVENT
result = Tcl_DoOneEvent(TCL_DONT_WAIT);
if (PyErr_CheckSignals() != 0)
return NULL;
@@ -1275,7 +1275,7 @@
thread-safe, but it seems *rather* safe as long as
no two threads call mainloop() simultaneously. */
Py_BEGIN_ALLOW_THREADS
- result = Tcl_WaitForEvent((Tcl_Time *)NULL);
+ result = PyTcl_WaitUntilEvent();
Py_END_ALLOW_THREADS
#else
result = Tcl_DoOneEvent(0);