diff options
Diffstat (limited to 'generic/tclInt.h')
-rw-r--r-- | generic/tclInt.h | 45 |
1 files changed, 11 insertions, 34 deletions
diff --git a/generic/tclInt.h b/generic/tclInt.h index 145d6b8..e685e77 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -12,7 +12,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclInt.h,v 1.82 2002/02/27 06:39:26 hobbs Exp $ + * RCS: @(#) $Id: tclInt.h,v 1.83 2002/02/27 07:08:28 hobbs Exp $ */ #ifndef _TCLINT @@ -2125,8 +2125,6 @@ EXTERN int TclCompileForCmd _ANSI_ARGS_((Tcl_Interp *interp, Tcl_Parse *parsePtr, struct CompileEnv *envPtr)); EXTERN int TclCompileForeachCmd _ANSI_ARGS_((Tcl_Interp *interp, Tcl_Parse *parsePtr, struct CompileEnv *envPtr)); -EXTERN int TclCompileGetsCmd _ANSI_ARGS_((Tcl_Interp *interp, - Tcl_Parse *parsePtr, struct CompileEnv *envPtr)); EXTERN int TclCompileIfCmd _ANSI_ARGS_((Tcl_Interp *interp, Tcl_Parse *parsePtr, struct CompileEnv *envPtr)); EXTERN int TclCompileIncrCmd _ANSI_ARGS_((Tcl_Interp *interp, @@ -2246,39 +2244,15 @@ EXTERN int TclCompileWhileCmd _ANSI_ARGS_((Tcl_Interp *interp, TclIncrObjsFreed(); \ } -#elif defined(TCL_THREADS) - -/* - * The TCL_THREADS mode is like the regular mode but allocates Tcl_Obj's - * from per-thread caches. - */ - -EXTERN Tcl_Obj *TclThreadAllocObj _ANSI_ARGS_((void)); -EXTERN void TclThreadFreeObj _ANSI_ARGS_((Tcl_Obj *)); - -# define TclNewObj(objPtr) \ - (objPtr) = TclThreadAllocObj(); \ - (objPtr)->refCount = 0; \ - (objPtr)->bytes = tclEmptyStringRep; \ - (objPtr)->length = 0; \ - (objPtr)->typePtr = NULL - -# define TclDecrRefCount(objPtr) \ - if (--(objPtr)->refCount <= 0) { \ - if (((objPtr)->bytes != NULL) \ - && ((objPtr)->bytes != tclEmptyStringRep)) { \ - ckfree((char *) (objPtr)->bytes); \ - } \ - if (((objPtr)->typePtr != NULL) \ - && ((objPtr)->typePtr->freeIntRepProc != NULL)) { \ - (objPtr)->typePtr->freeIntRepProc(objPtr); \ - } \ - TclThreadFreeObj((objPtr)); \ - } - #else /* not TCL_MEM_DEBUG */ +#ifdef TCL_THREADS +/* declared in tclObj.c */ +extern Tcl_Mutex tclObjMutex; +#endif + # define TclNewObj(objPtr) \ + Tcl_MutexLock(&tclObjMutex); \ if (tclFreeObjList == NULL) { \ TclAllocateFreeObjects(); \ } \ @@ -2289,7 +2263,8 @@ EXTERN void TclThreadFreeObj _ANSI_ARGS_((Tcl_Obj *)); (objPtr)->bytes = tclEmptyStringRep; \ (objPtr)->length = 0; \ (objPtr)->typePtr = NULL; \ - TclIncrObjsAllocated(); + TclIncrObjsAllocated(); \ + Tcl_MutexUnlock(&tclObjMutex) # define TclDecrRefCount(objPtr) \ if (--(objPtr)->refCount <= 0) { \ @@ -2301,9 +2276,11 @@ EXTERN void TclThreadFreeObj _ANSI_ARGS_((Tcl_Obj *)); && ((objPtr)->typePtr->freeIntRepProc != NULL)) { \ (objPtr)->typePtr->freeIntRepProc(objPtr); \ } \ + Tcl_MutexLock(&tclObjMutex); \ (objPtr)->internalRep.otherValuePtr = (VOID *) tclFreeObjList; \ tclFreeObjList = (objPtr); \ TclIncrObjsFreed(); \ + Tcl_MutexUnlock(&tclObjMutex); \ } #endif /* TCL_MEM_DEBUG */ |