[Python-Dev] PEP needed? Introducing Tcl objects

Jeff Hobbs JeffH@ActiveState.com
Sat, 16 Feb 2002 02:01:39 -0800

> From: martin@mira [mailto:martin@mira]On Behalf Of Martin v. Loewis
> David Ascher <DavidA@ActiveState.com> writes:
> > The Sleep() call is a perf problem.
> It certainly is, but it is also necessary to have.

Why?  I suspect if you inverted the control behavior to run the
Tcl event loop as it's designed and trigger signals with
Tcl_AsyncMark, you would have no problem.  Alternatively, you
could do Tcl_CreateEventSource, of if threading is really
necessary, build Tcl with threads and use Tcl_ThreadQueueEvent.
It has all the APIs to approach this from several different
angles without have to toss a gratuitous Sleep in there that
does nothing more than have people scratch their head and
wonder why Tkinter appears so slow.

BTW, I know you were tying into Tk before Tk was properly
thread-safe, but those issues have been addressed (although
it is highly recommended to stick to using Tk in one thread
as things like X aren't guaranteed to be thread-safe).