[Python-Dev] PEP needed? Introducing Tcl objects

Jeffrey Hobbs jeff@hobbs.org
Tue, 19 Feb 2002 08:53:53 -0800


Martin,

	...
> Of Jeff's options, invoking Tcl_SetMaxBlockTime seemed to be most
> promising: I want Tcl_DoOneEvent to return after 20ms, to give other
> Tcl threads a chance. So I invented the patch
	...
> ought to continously increase the counter in the label (once a
> second), but doesn't, atleast not on Linux, using Tcl 8.3.3.  In the
> strace output, it appears that it first does a select call with a
> timeout, but that is followed by one without time limit before
> Tcl_DoOneEvent returns.

IIRC, Tcl_SetMaxBlockTime is a one-short call - it sets the next
block time, not all block times.  I'm sure there was a reason for
this, but that was implemented before I was a core guy.  Anyway,
I think you just need to try:

-		result = Tcl_DoOneEvent(TCL_DONT_WAIT);
+		Tcl_SetMaxBlockTime(&blocktime);
+		result = Tcl_DoOneEvent(0);

and see if that satisfies the need for responsiveness as well as
not blocking.

Thanks,

Jeff