summaryrefslogtreecommitdiffstats
path: root/generic/tclInt.h
diff options
context:
space:
mode:
authorhobbs <hobbs>2002-04-23 17:03:34 (GMT)
committerhobbs <hobbs>2002-04-23 17:03:34 (GMT)
commitd6befe3b0ecd8da7c936827f0c6c2e3fb41b6496 (patch)
treed5a9ad88cb63d360c0bef3b2ec2d73058e8e0227 /generic/tclInt.h
parentbf47097699f7f908f97e75a28b1b8d0817ed7bae (diff)
downloadtcl-d6befe3b0ecd8da7c936827f0c6c2e3fb41b6496.zip
tcl-d6befe3b0ecd8da7c936827f0c6c2e3fb41b6496.tar.gz
tcl-d6befe3b0ecd8da7c936827f0c6c2e3fb41b6496.tar.bz2
* generic/tclAlloc.c:
* generic/tclInt.h: * generic/tclThreadAlloc.c (new): * unix/Makefile.in: * unix/tclUnixThrd.c: * win/Makefile.in: * win/tclWinInt.h: * win/tclWinThrd.c: added new threaded allocator contributed by AOL that significantly reduces lock contention when multiple threads are in use. Only Windows and Unix implementations are ready, and the Windows one may need work. It is only used by default on Unix for now, and requires that USE_THREAD_ALLOC be defined (--enable-threads on Unix will define this).
Diffstat (limited to 'generic/tclInt.h')
-rw-r--r--generic/tclInt.h32
1 files changed, 31 insertions, 1 deletions
diff --git a/generic/tclInt.h b/generic/tclInt.h
index a2dc4ac..f87eac9 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.84 2002/03/06 15:04:58 msofer Exp $
+ * RCS: @(#) $Id: tclInt.h,v 1.85 2002/04/23 17:03:34 hobbs Exp $
*/
#ifndef _TCLINT
@@ -2244,6 +2244,36 @@ EXTERN int TclCompileWhileCmd _ANSI_ARGS_((Tcl_Interp *interp,
TclIncrObjsFreed(); \
}
+#elif defined(TCL_THREADS) && defined(USE_THREAD_ALLOC)
+
+/*
+ * 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