diff options
author | dkf <donal.k.fellows@manchester.ac.uk> | 2009-12-28 09:58:14 (GMT) |
---|---|---|
committer | dkf <donal.k.fellows@manchester.ac.uk> | 2009-12-28 09:58:14 (GMT) |
commit | 174ac07d57f2a496bf57aca9b076f42b5c1c4e25 (patch) | |
tree | 4669830f13922653c68d7eee27f1077931fa29b0 /generic/tclInterp.c | |
parent | 476bb99185f813f3c90f0ef2156cebf0f759c27e (diff) | |
download | tcl-174ac07d57f2a496bf57aca9b076f42b5c1c4e25.zip tcl-174ac07d57f2a496bf57aca9b076f42b5c1c4e25.tar.gz tcl-174ac07d57f2a496bf57aca9b076f42b5c1c4e25.tar.bz2 |
[Bug 2891362]: Make time limits work better with the event loop.
Diffstat (limited to 'generic/tclInterp.c')
-rw-r--r-- | generic/tclInterp.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/generic/tclInterp.c b/generic/tclInterp.c index 89b635d..b724abf 100644 --- a/generic/tclInterp.c +++ b/generic/tclInterp.c @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclInterp.c,v 1.108 2009/12/16 23:26:01 nijtmans Exp $ + * RCS: @(#) $Id: tclInterp.c,v 1.109 2009/12/28 09:58:14 dkf Exp $ */ #include "tclInt.h" @@ -928,7 +928,8 @@ Tcl_InterpObjCmd( int limitType; if (objc < 4) { - Tcl_WrongNumArgs(interp, 2, objv, "path limitType ?-option value ...?"); + Tcl_WrongNumArgs(interp, 2, objv, + "path limitType ?-option value ...?"); return TCL_ERROR; } slaveInterp = GetInterp(interp, objv[2]); @@ -3745,10 +3746,20 @@ TimeLimitCallback( ClientData clientData) { Tcl_Interp *interp = clientData; + Interp *iPtr = clientData; int code; Tcl_Preserve(interp); - ((Interp *) interp)->limit.timeEvent = NULL; + iPtr->limit.timeEvent = NULL; + + /* + * Must reset the granularity ticker here to force an immediate full + * check. This is OK because we're swallowing the cost in the overall cost + * of the event loop. [Bug 2891362] + */ + + iPtr->limit.granularityTicker = 0; + code = Tcl_LimitCheck(interp); if (code != TCL_OK) { Tcl_AddErrorInfo(interp, "\n (while waiting for event)"); |