summaryrefslogtreecommitdiffstats
path: root/generic/tclBasic.c
diff options
context:
space:
mode:
Diffstat (limited to 'generic/tclBasic.c')
-rw-r--r--generic/tclBasic.c36
1 files changed, 35 insertions, 1 deletions
diff --git a/generic/tclBasic.c b/generic/tclBasic.c
index 8c1b739..71d0874 100644
--- a/generic/tclBasic.c
+++ b/generic/tclBasic.c
@@ -13,7 +13,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclBasic.c,v 1.87 2003/09/29 14:37:14 dkf Exp $
+ * RCS: @(#) $Id: tclBasic.c,v 1.88 2003/09/29 21:38:49 dkf Exp $
*/
#include "tclInt.h"
@@ -384,6 +384,19 @@ Tcl_CreateInterp()
iPtr->execEnvPtr = TclCreateExecEnv(interp);
/*
+ * Initialise the resource limiting framework.
+ */
+
+ iPtr->limitCheckCounter = 0;
+ iPtr->limits = 0;
+ iPtr->timeGranularity = 0;
+ iPtr->timeLimit = 0;
+ iPtr->timeLimitHandlers = NULL;
+ iPtr->cmdcountGranularity = 0;
+ iPtr->cmdcountLimit = 0;
+ iPtr->cmdcountLimitHandlers = NULL;
+
+ /*
* Initialize the compilation and execution statistics kept for this
* interpreter.
*/
@@ -969,6 +982,7 @@ DeleteInterpProc(interp)
Tcl_HashSearch search;
Tcl_HashTable *hTablePtr;
ResolverScheme *resPtr, *nextResPtr;
+ LimitHandler *lhPtr, *nextLhPtr;
/*
* Punt if there is an error in the Tcl_Release/Tcl_Preserve matchup.
@@ -990,6 +1004,26 @@ DeleteInterpProc(interp)
TclHandleFree(iPtr->handle);
/*
+ * Destroy any resource limiting handlers that this interpreter
+ * has; we're on our way out now, so failing because of resource
+ * limits now would be very silly indeed.
+ */
+
+ iPtr->limits = 0;
+ for (lhPtr=iPtr->timeLimitHandlers ; lhPtr!=NULL ; lhPtr=nextLhPtr) {
+ nextLhPtr = lhPtr->next;
+ Tcl_DecrRefCount(lhPtr->handlerObj);
+ lhPtr->handlerObj = NULL;
+ Tcl_EventuallyFree((char *) lhPtr, TCL_DYNAMIC);
+ }
+ for (lhPtr=iPtr->cmdcountLimitHandlers ; lhPtr!=NULL ; lhPtr=nextLhPtr) {
+ nextLhPtr = lhPtr->next;
+ Tcl_DecrRefCount(lhPtr->handlerObj);
+ lhPtr->handlerObj = NULL;
+ Tcl_EventuallyFree((char *) lhPtr, TCL_DYNAMIC);
+ }
+
+ /*
* Dismantle everything in the global namespace except for the
* "errorInfo" and "errorCode" variables. These remain until the
* namespace is actually destroyed, in case any errors occur.