52 lines
1.9 KiB
Plaintext
52 lines
1.9 KiB
Plaintext
From: herzog at online.de (Bernhard Herzog)
|
|
Date: 11 Apr 1999 14:40:26 +0200
|
|
Subject: _tkinter.c, threads and C-modules in 1.5.2
|
|
Message-ID: <m3aewfba9x.fsf@greebo.nodomain.de>
|
|
Content-Length: 1662
|
|
X-UID: 253
|
|
|
|
|
|
A few weeks ago, there was a bug report on c.l.py regarding an
|
|
incompatibility between Sketch and Python 1.5.2b2 on Linux/glibc2. It
|
|
seems to me that the cause for the problems is the new Tcl-lock in
|
|
1.5.2.
|
|
|
|
The tcl-lock was introduced for better thread support in Tkinter.
|
|
Whenever _tkinter calls the tcl interpreter, it releases the python-lock
|
|
and acquires the tcl-lock. Sketch defines some tcl-callbacks in C, which
|
|
in turn may call the python interpreter, but without releasing the
|
|
tcl-lock and acquiring the python-lock. I think that this is the cause,
|
|
because compiling just the _tkinter module without thread support cures
|
|
the problem, or so I'm told, I can't test this myself at the moment as
|
|
I'm still on libc5.
|
|
|
|
The question now is, how do I make Sketch work correctly with a
|
|
threadable _tkinter? AFAICT, Sketch would have to have access to some
|
|
static variables in _tkinter.c.
|
|
|
|
The best solution IMO would be to give third-party C-modules access to
|
|
the functionality of the macros ENTER_TCL, LEAVE_TCL, etc, via some
|
|
C-functions to access those variables and a _tkinter headerfile
|
|
installed with the other Python headerfiles.
|
|
|
|
As it's probably too late to get something like this into Python 1.5.2
|
|
final :(, the easiest solution for Sketch is to provide its own
|
|
non-threaded _tkinter module that is used instead of Python's if Sketch
|
|
runs with Python 1.5.2.
|
|
|
|
It's kind of funny that 1.5.2 make it both easier, with the new
|
|
interpaddr() method, and harder, with the tcl-lock, to extend tkinter
|
|
with C-modules.
|
|
|
|
|
|
Bernhard
|
|
|
|
|
|
--
|
|
Bernhard Herzog | Sketch, a python based drawing program
|
|
herzog at online.de | http://www.online.de/home/sketch/
|
|
|
|
|
|
|
|
|