summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2013-09-10 18:46:23 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2013-09-10 18:46:23 (GMT)
commitc3f14f655071b78b6aa7867537d485e1454e2f88 (patch)
treeb559fdd9bec785783a1123f268061c27dc814370
parentba7223881b8ae57b0edb93eae8dd280190dfd78e (diff)
downloadtcl-bug_547989.zip
tcl-bug_547989.tar.gz
tcl-bug_547989.tar.bz2
[547989] Proposed implementation of the change described in the comments of the bug report.bug_547989
-rw-r--r--generic/tcl.decls7
-rw-r--r--generic/tclAlloc.c2
-rw-r--r--generic/tclCkalloc.c2
-rw-r--r--generic/tclDecls.h8
-rw-r--r--generic/tclInt.decls3
-rw-r--r--generic/tclIntDecls.h5
-rw-r--r--generic/tclStubInit.c3
-rw-r--r--generic/tclThreadAlloc.c2
-rw-r--r--unix/tclUnixThrd.c6
-rw-r--r--win/tclWinThrd.c4
10 files changed, 25 insertions, 17 deletions
diff --git a/generic/tcl.decls b/generic/tcl.decls
index 1829249..ab89fbc 100644
--- a/generic/tcl.decls
+++ b/generic/tcl.decls
@@ -1370,9 +1370,10 @@ declare 385 {
declare 386 {
void Tcl_SetNotifier(Tcl_NotifierProcs *notifierProcPtr)
}
-declare 387 {
- Tcl_Mutex *Tcl_GetAllocMutex(void)
-}
+### Removed from stub table: see [Bug 547989]
+#declare 387 {
+# Tcl_Mutex *Tcl_GetAllocMutex(void)
+#}
declare 388 {
int Tcl_GetChannelNames(Tcl_Interp *interp)
}
diff --git a/generic/tclAlloc.c b/generic/tclAlloc.c
index ae61e85..199f6a8 100644
--- a/generic/tclAlloc.c
+++ b/generic/tclAlloc.c
@@ -172,7 +172,7 @@ TclInitAlloc(void)
if (!allocInit) {
allocInit = 1;
#ifdef TCL_THREADS
- allocMutexPtr = Tcl_GetAllocMutex();
+ allocMutexPtr = TclpGetAllocMutex();
#endif
}
}
diff --git a/generic/tclCkalloc.c b/generic/tclCkalloc.c
index 70e64f0..1c06fcb 100644
--- a/generic/tclCkalloc.c
+++ b/generic/tclCkalloc.c
@@ -155,7 +155,7 @@ TclInitDbCkalloc(void)
{
if (!ckallocInit) {
ckallocInit = 1;
- ckallocMutexPtr = Tcl_GetAllocMutex();
+ ckallocMutexPtr = TclpGetAllocMutex();
#ifndef TCL_THREADS
/* Silence compiler warning */
(void)ckallocMutexPtr;
diff --git a/generic/tclDecls.h b/generic/tclDecls.h
index 4d40be1..affc9c8 100644
--- a/generic/tclDecls.h
+++ b/generic/tclDecls.h
@@ -1116,8 +1116,7 @@ EXTERN int Tcl_RegExpMatchObj(Tcl_Interp *interp,
Tcl_Obj *textObj, Tcl_Obj *patternObj);
/* 386 */
EXTERN void Tcl_SetNotifier(Tcl_NotifierProcs *notifierProcPtr);
-/* 387 */
-EXTERN Tcl_Mutex * Tcl_GetAllocMutex(void);
+/* Slot 387 is reserved */
/* 388 */
EXTERN int Tcl_GetChannelNames(Tcl_Interp *interp);
/* 389 */
@@ -2233,7 +2232,7 @@ typedef struct TclStubs {
void (*tcl_AppendUnicodeToObj) (Tcl_Obj *objPtr, const Tcl_UniChar *unicode, int length); /* 384 */
int (*tcl_RegExpMatchObj) (Tcl_Interp *interp, Tcl_Obj *textObj, Tcl_Obj *patternObj); /* 385 */
void (*tcl_SetNotifier) (Tcl_NotifierProcs *notifierProcPtr); /* 386 */
- Tcl_Mutex * (*tcl_GetAllocMutex) (void); /* 387 */
+ void (*reserved387)(void);
int (*tcl_GetChannelNames) (Tcl_Interp *interp); /* 388 */
int (*tcl_GetChannelNamesEx) (Tcl_Interp *interp, const char *pattern); /* 389 */
int (*tcl_ProcObjCmd) (ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); /* 390 */
@@ -3283,8 +3282,7 @@ extern const TclStubs *tclStubsPtr;
(tclStubsPtr->tcl_RegExpMatchObj) /* 385 */
#define Tcl_SetNotifier \
(tclStubsPtr->tcl_SetNotifier) /* 386 */
-#define Tcl_GetAllocMutex \
- (tclStubsPtr->tcl_GetAllocMutex) /* 387 */
+/* Slot 387 is reserved */
#define Tcl_GetChannelNames \
(tclStubsPtr->tcl_GetChannelNames) /* 388 */
#define Tcl_GetChannelNamesEx \
diff --git a/generic/tclInt.decls b/generic/tclInt.decls
index f0e907f..976689e 100644
--- a/generic/tclInt.decls
+++ b/generic/tclInt.decls
@@ -1006,6 +1006,9 @@ declare 249 {
declare 250 {
void TclSetSlaveCancelFlags(Tcl_Interp *interp, int flags, int force)
}
+declare 251 {
+ Tcl_Mutex *TclpGetAllocMutex(void)
+}
##############################################################################
diff --git a/generic/tclIntDecls.h b/generic/tclIntDecls.h
index 533d6f4..81a28d3 100644
--- a/generic/tclIntDecls.h
+++ b/generic/tclIntDecls.h
@@ -610,6 +610,8 @@ EXTERN char * TclDoubleDigits(double dv, int ndigits, int flags,
/* 250 */
EXTERN void TclSetSlaveCancelFlags(Tcl_Interp *interp, int flags,
int force);
+/* 251 */
+EXTERN Tcl_Mutex * TclpGetAllocMutex(void);
typedef struct TclIntStubs {
int magic;
@@ -866,6 +868,7 @@ typedef struct TclIntStubs {
int (*tclCopyChannel) (Tcl_Interp *interp, Tcl_Channel inChan, Tcl_Channel outChan, Tcl_WideInt toRead, Tcl_Obj *cmdPtr); /* 248 */
char * (*tclDoubleDigits) (double dv, int ndigits, int flags, int *decpt, int *signum, char **endPtr); /* 249 */
void (*tclSetSlaveCancelFlags) (Tcl_Interp *interp, int flags, int force); /* 250 */
+ Tcl_Mutex * (*tclpGetAllocMutex) (void); /* 251 */
} TclIntStubs;
#ifdef __cplusplus
@@ -1297,6 +1300,8 @@ extern const TclIntStubs *tclIntStubsPtr;
(tclIntStubsPtr->tclDoubleDigits) /* 249 */
#define TclSetSlaveCancelFlags \
(tclIntStubsPtr->tclSetSlaveCancelFlags) /* 250 */
+#define TclpGetAllocMutex \
+ (tclIntStubsPtr->tclpGetAllocMutex) /* 251 */
#endif /* defined(USE_TCL_STUBS) */
diff --git a/generic/tclStubInit.c b/generic/tclStubInit.c
index 782bbdf..b9c9c9e 100644
--- a/generic/tclStubInit.c
+++ b/generic/tclStubInit.c
@@ -553,6 +553,7 @@ static const TclIntStubs tclIntStubs = {
TclCopyChannel, /* 248 */
TclDoubleDigits, /* 249 */
TclSetSlaveCancelFlags, /* 250 */
+ TclpGetAllocMutex, /* 251 */
};
static const TclIntPlatStubs tclIntPlatStubs = {
@@ -1161,7 +1162,7 @@ const TclStubs tclStubs = {
Tcl_AppendUnicodeToObj, /* 384 */
Tcl_RegExpMatchObj, /* 385 */
Tcl_SetNotifier, /* 386 */
- Tcl_GetAllocMutex, /* 387 */
+ 0, /* 387 */
Tcl_GetChannelNames, /* 388 */
Tcl_GetChannelNamesEx, /* 389 */
Tcl_ProcObjCmd, /* 390 */
diff --git a/generic/tclThreadAlloc.c b/generic/tclThreadAlloc.c
index abd5af5..7491a4b 100644
--- a/generic/tclThreadAlloc.c
+++ b/generic/tclThreadAlloc.c
@@ -195,7 +195,7 @@ GetCache(void)
Tcl_Mutex *initLockPtr;
unsigned int i;
- initLockPtr = Tcl_GetAllocMutex();
+ initLockPtr = TclpGetAllocMutex();
Tcl_MutexLock(initLockPtr);
if (listLockPtr == NULL) {
listLockPtr = TclpNewAllocMutex();
diff --git a/unix/tclUnixThrd.c b/unix/tclUnixThrd.c
index f469341..73c9095 100644
--- a/unix/tclUnixThrd.c
+++ b/unix/tclUnixThrd.c
@@ -360,12 +360,11 @@ TclpMasterUnlock(void)
pthread_mutex_unlock(&masterLock);
#endif
}
-
/*
*----------------------------------------------------------------------
*
- * Tcl_GetAllocMutex
+ * TclpGetAllocMutex
*
* This procedure returns a pointer to a statically initialized mutex for
* use by the memory allocator. The alloctor must use this lock, because
@@ -382,10 +381,11 @@ TclpMasterUnlock(void)
*/
Tcl_Mutex *
-Tcl_GetAllocMutex(void)
+TclpGetAllocMutex(void)
{
#ifdef TCL_THREADS
pthread_mutex_t **allocLockPtrPtr = &allocLockPtr;
+
return (Tcl_Mutex *) allocLockPtrPtr;
#else
return NULL;
diff --git a/win/tclWinThrd.c b/win/tclWinThrd.c
index 1c9d483..f2d2c00 100644
--- a/win/tclWinThrd.c
+++ b/win/tclWinThrd.c
@@ -464,7 +464,7 @@ TclpMasterUnlock(void)
/*
*----------------------------------------------------------------------
*
- * Tcl_GetAllocMutex
+ * TclpGetAllocMutex
*
* This procedure returns a pointer to a statically initialized mutex for
* use by the memory allocator. The alloctor must use this lock, because
@@ -481,7 +481,7 @@ TclpMasterUnlock(void)
*/
Tcl_Mutex *
-Tcl_GetAllocMutex(void)
+TclpGetAllocMutex(void)
{
#ifdef TCL_THREADS
if (!allocOnce) {