diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2015-06-16 15:24:51 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2015-06-16 15:24:51 (GMT) |
commit | 61235a19fdbc4ccea9e122d0be34888ab92fc798 (patch) | |
tree | f9ed27e54ccf335ed3a7b3975210030637754b77 | |
parent | bd5043a0eea076716ef8b53a0985464965165bd9 (diff) | |
download | tcl-61235a19fdbc4ccea9e122d0be34888ab92fc798.zip tcl-61235a19fdbc4ccea9e122d0be34888ab92fc798.tar.gz tcl-61235a19fdbc4ccea9e122d0be34888ab92fc798.tar.bz2 |
Change Tcl_MutexUnlockAndFinalize() to internal function TclpMutexUnlockAndFinalize(). This does not require a TIP, and still should fix the reported bug.
-rw-r--r-- | doc/Thread.3 | 20 | ||||
-rw-r--r-- | doc/TraceCmd.3 | 2 | ||||
-rw-r--r-- | generic/tcl.decls | 5 | ||||
-rw-r--r-- | generic/tcl.h | 2 | ||||
-rw-r--r-- | generic/tclDecls.h | 5 | ||||
-rw-r--r-- | generic/tclInt.h | 1 | ||||
-rw-r--r-- | generic/tclStubInit.c | 1 | ||||
-rw-r--r-- | generic/tclThread.c | 5 | ||||
-rw-r--r-- | unix/tclUnixNotfy.c | 2 |
9 files changed, 11 insertions, 32 deletions
diff --git a/doc/Thread.3 b/doc/Thread.3 index c84dcb4..ac5f2ba 100644 --- a/doc/Thread.3 +++ b/doc/Thread.3 @@ -9,7 +9,7 @@ .so man.macros .BS .SH NAME -Tcl_ConditionNotify, Tcl_ConditionWait, Tcl_ConditionFinalize, Tcl_GetThreadData, Tcl_MutexLock, Tcl_MutexUnlock, Tcl_MutexFinalize, Tcl_MutexUnlockAndFinalize, Tcl_CreateThread, Tcl_JoinThread \- Tcl thread support +Tcl_ConditionNotify, Tcl_ConditionWait, Tcl_ConditionFinalize, Tcl_GetThreadData, Tcl_MutexLock, Tcl_MutexUnlock, Tcl_MutexFinalize, Tcl_CreateThread, Tcl_JoinThread \- Tcl thread support .SH SYNOPSIS .nf \fB#include <tcl.h>\fR @@ -35,9 +35,6 @@ void void \fBTcl_MutexFinalize\fR(\fImutexPtr\fR) .sp -void -\fBTcl_MutexUnlockAndFinalize\fR(\fImutexPtr\fR) -.sp int \fBTcl_CreateThread\fR(\fIidPtr, proc, clientData, stackSize, flags\fR) .sp @@ -141,16 +138,11 @@ A mutex is a lock that is used to serialize all threads through a piece of code by calling \fBTcl_MutexLock\fR and \fBTcl_MutexUnlock\fR. If one thread holds a mutex, any other thread calling \fBTcl_MutexLock\fR will block until \fBTcl_MutexUnlock\fR is called. -A mutex can be destroyed after its use by calling \fBTcl_MutexFinalize\fR or -\fBTcl_MutexUnlockAndFinalize\fR. The \fBTcl_MutexFinalize\fR function may -only be used on unlocked mutexes; otherwise, its behavior is undefined. The -\fBTcl_MutexUnlockAndFinalize\fR function may only be used on locked mutexes; -otherwise, its behavior is undefined. +A mutex can be destroyed after its use by calling \fBTcl_MutexFinalize\fR. The result of locking a mutex twice from the same thread is undefined. On some platforms it will result in a deadlock. -The \fBTcl_MutexLock\fR, \fBTcl_MutexUnlock\fR, \fBTcl_MutexFinalize\fR, and -\fBTcl_MutexUnlockAndFinalize\fR procedures are defined as empty macros if -not compiling with threads enabled. +The \fBTcl_MutexLock\fR, \fBTcl_MutexUnlock\fR and \fBTcl_MutexFinalize\fR +procedures are defined as empty macros if not compiling with threads enabled. For declaration of mutexes the \fBTCL_DECLARE_MUTEX\fR macro should be used. This macro assures correct mutex handling even when the core is compiled without threads enabled. @@ -184,8 +176,8 @@ They are implemented as opaque pointers that should be NULL upon first use. The mutexes and condition variables are either cleaned up by process exit handlers (if living that long) or -explicitly by calls to \fBTcl_MutexFinalize\fR (or -\fBTcl_MutexUnlockAndFinalize\fR) and \fBTcl_ConditionFinalize\fR. +explicitly by calls to \fBTcl_MutexFinalize\fR or +\fBTcl_ConditionFinalize\fR. Thread local storage is reclaimed during \fBTcl_FinalizeThread\fR. .SH "SCRIPT-LEVEL ACCESS TO THREADS" .PP diff --git a/doc/TraceCmd.3 b/doc/TraceCmd.3 index db2f5d5..fccc0c6 100644 --- a/doc/TraceCmd.3 +++ b/doc/TraceCmd.3 @@ -78,7 +78,7 @@ created. \fIClientData\fR typically points to an application-specific data structure that describes what to do when \fIproc\fR is invoked. \fIOldName\fR gives the name of the command being renamed, and \fInewName\fR gives the name that the command is being renamed to (or -an empty string or NULL when the command is being deleted.) +NULL when the command is being deleted.) \fIFlags\fR is an OR'ed combination of bits potentially providing several pieces of information. One of the bits \fBTCL_TRACE_RENAME\fR and \fBTCL_TRACE_DELETE\fR will be set in \fIflags\fR to indicate which diff --git a/generic/tcl.decls b/generic/tcl.decls index e80fe0f..1829249 100644 --- a/generic/tcl.decls +++ b/generic/tcl.decls @@ -2326,11 +2326,6 @@ declare 630 { # ----- BASELINE -- FOR -- 8.6.0 ----- # -# TIP #435 -declare 631 { - void Tcl_MutexUnlockAndFinalize(Tcl_Mutex *mutex) -} - ############################################################################## # Define the platform specific public Tcl interface. These functions are only diff --git a/generic/tcl.h b/generic/tcl.h index 80f924a..297b42c 100644 --- a/generic/tcl.h +++ b/generic/tcl.h @@ -2592,8 +2592,6 @@ EXTERN void Tcl_GetMemoryInfo(Tcl_DString *dsPtr); #define Tcl_MutexLock(mutexPtr) #undef Tcl_MutexUnlock #define Tcl_MutexUnlock(mutexPtr) -#undef Tcl_MutexUnlockAndFinalize -#define Tcl_MutexUnlockAndFinalize(mutexPtr) #undef Tcl_MutexFinalize #define Tcl_MutexFinalize(mutexPtr) #undef Tcl_ConditionNotify diff --git a/generic/tclDecls.h b/generic/tclDecls.h index f4ebc53..91c0add 100644 --- a/generic/tclDecls.h +++ b/generic/tclDecls.h @@ -1815,8 +1815,6 @@ EXTERN int Tcl_FSUnloadFile(Tcl_Interp *interp, EXTERN void Tcl_ZlibStreamSetCompressionDictionary( Tcl_ZlibStream zhandle, Tcl_Obj *compressionDictionaryObj); -/* 631 */ -EXTERN void Tcl_MutexUnlockAndFinalize(Tcl_Mutex *mutex); typedef struct { const struct TclPlatStubs *tclPlatStubs; @@ -2483,7 +2481,6 @@ typedef struct TclStubs { void * (*tcl_FindSymbol) (Tcl_Interp *interp, Tcl_LoadHandle handle, const char *symbol); /* 628 */ int (*tcl_FSUnloadFile) (Tcl_Interp *interp, Tcl_LoadHandle handlePtr); /* 629 */ void (*tcl_ZlibStreamSetCompressionDictionary) (Tcl_ZlibStream zhandle, Tcl_Obj *compressionDictionaryObj); /* 630 */ - void (*tcl_MutexUnlockAndFinalize) (Tcl_Mutex *mutex); /* 631 */ } TclStubs; extern const TclStubs *tclStubsPtr; @@ -3776,8 +3773,6 @@ extern const TclStubs *tclStubsPtr; (tclStubsPtr->tcl_FSUnloadFile) /* 629 */ #define Tcl_ZlibStreamSetCompressionDictionary \ (tclStubsPtr->tcl_ZlibStreamSetCompressionDictionary) /* 630 */ -#define Tcl_MutexUnlockAndFinalize \ - (tclStubsPtr->tcl_MutexUnlockAndFinalize) /* 631 */ #endif /* defined(USE_TCL_STUBS) */ diff --git a/generic/tclInt.h b/generic/tclInt.h index 51d153b..5a8c9ca 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -3061,6 +3061,7 @@ MODULE_SCOPE void TclpMasterLock(void); MODULE_SCOPE void TclpMasterUnlock(void); MODULE_SCOPE void TclpMutexLock(void); MODULE_SCOPE void TclpMutexUnlock(void); +MODULE_SCOPE void TclpMutexUnlockAndFinalize(Tcl_Mutex *mutex); MODULE_SCOPE int TclpMatchFiles(Tcl_Interp *interp, char *separators, Tcl_DString *dirPtr, char *pattern, char *tail); MODULE_SCOPE int TclpObjNormalizePath(Tcl_Interp *interp, diff --git a/generic/tclStubInit.c b/generic/tclStubInit.c index f0d00ee..7a84cba 100644 --- a/generic/tclStubInit.c +++ b/generic/tclStubInit.c @@ -1412,7 +1412,6 @@ const TclStubs tclStubs = { Tcl_FindSymbol, /* 628 */ Tcl_FSUnloadFile, /* 629 */ Tcl_ZlibStreamSetCompressionDictionary, /* 630 */ - Tcl_MutexUnlockAndFinalize, /* 631 */ }; /* !END!: Do not edit above this line. */ diff --git a/generic/tclThread.c b/generic/tclThread.c index b46ddf5..065df0e 100644 --- a/generic/tclThread.c +++ b/generic/tclThread.c @@ -50,7 +50,6 @@ static void RememberSyncObject(void *objPtr, #undef Tcl_MutexLock #undef Tcl_MutexUnlock #undef Tcl_MutexFinalize -#undef Tcl_MutexUnlockAndFinalize #undef Tcl_ConditionNotify #undef Tcl_ConditionWait #undef Tcl_ConditionFinalize @@ -285,7 +284,7 @@ Tcl_MutexFinalize( /* *---------------------------------------------------------------------- * - * Tcl_MutexUnlockAndFinalize -- + * TclpMutexUnlockAndFinalize -- * * This procedure is invoked to unlock and then finalize a mutex. * The mutex must have been locked by Tcl_MutexLock. It is also @@ -302,7 +301,7 @@ Tcl_MutexFinalize( */ void -Tcl_MutexUnlockAndFinalize( +TclpMutexUnlockAndFinalize( Tcl_Mutex *mutexPtr) { Tcl_Mutex mutex; diff --git a/unix/tclUnixNotfy.c b/unix/tclUnixNotfy.c index 219dd75..a009fb1 100644 --- a/unix/tclUnixNotfy.c +++ b/unix/tclUnixNotfy.c @@ -1384,7 +1384,7 @@ AtForkChild(void) { TclpMutexUnlock(); TclpMasterUnlock(); - Tcl_MutexUnlockAndFinalize(¬ifierMutex); + TclpMutexUnlockAndFinalize(¬ifierMutex); Tcl_InitNotifier(); } #endif /* HAVE_PTHREAD_ATFORK */ |