diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2016-03-25 14:41:26 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2016-03-25 14:41:26 (GMT) |
commit | 6cf1f7bacfe7e787c6468eed2b41194dd1c6e333 (patch) | |
tree | 3e0aa363fe324f88ce36cf4860d0eb3c0f5bfb19 /win | |
parent | a4933e22d0b56bf07cf35cb90eb1f6fd6c9e48cb (diff) | |
parent | 77cc7b40aa68fe4c7ef545f76495ba18c4ace487 (diff) | |
download | tcl-6cf1f7bacfe7e787c6468eed2b41194dd1c6e333.zip tcl-6cf1f7bacfe7e787c6468eed2b41194dd1c6e333.tar.gz tcl-6cf1f7bacfe7e787c6468eed2b41194dd1c6e333.tar.bz2 |
- Undo unix notifier changes: too risky at this moment.
- Merge trunk
- (cherry-pick from dhr-micro-optimization): Micro-optimization: remove double checked lock from TclGetAllocCache in favour of initialization in TclInitSubsystems
Diffstat (limited to 'win')
-rwxr-xr-x | win/configure | 2 | ||||
-rw-r--r-- | win/tcl.m4 | 2 | ||||
-rw-r--r-- | win/tclWinThrd.c | 33 |
3 files changed, 17 insertions, 20 deletions
diff --git a/win/configure b/win/configure index a1f57d1..73d6d9f 100755 --- a/win/configure +++ b/win/configure @@ -4165,7 +4165,7 @@ $as_echo "using shared flags" >&6; } CFLAGS_DEBUG=-g CFLAGS_OPTIMIZE="-O2 -fomit-frame-pointer" - CFLAGS_WARNING="-Wall -Wdeclaration-after-statement" + CFLAGS_WARNING="-Wall -Wsign-compare -Wdeclaration-after-statement" LDFLAGS_DEBUG= LDFLAGS_OPTIMIZE= @@ -727,7 +727,7 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [ CFLAGS_DEBUG=-g CFLAGS_OPTIMIZE="-O2 -fomit-frame-pointer" - CFLAGS_WARNING="-Wall -Wdeclaration-after-statement" + CFLAGS_WARNING="-Wall -Wsign-compare -Wdeclaration-after-statement" LDFLAGS_DEBUG= LDFLAGS_OPTIMIZE= diff --git a/win/tclWinThrd.c b/win/tclWinThrd.c index e44363b..8791c19 100644 --- a/win/tclWinThrd.c +++ b/win/tclWinThrd.c @@ -119,7 +119,6 @@ typedef struct WinCondition { */ #ifdef USE_THREAD_ALLOC -static int once; static DWORD tlsKey; typedef struct allocMutex { @@ -968,24 +967,24 @@ TclpFreeAllocMutex( free(lockPtr); } +void +TclpInitThreadAlloc(void) +{ + /* + * We need to make sure that TclpFreeAllocCache is called on each + * thread that calls this, but only on threads that call this. + */ + + tlsKey = TlsAlloc(); + if (tlsKey == TLS_OUT_OF_INDEXES) { + Tcl_Panic("could not allocate thread local storage"); + } +} + void * TclpGetAllocCache(void) { void *result; - - if (!once) { - /* - * We need to make sure that TclpFreeAllocCache is called on each - * thread that calls this, but only on threads that call this. - */ - - tlsKey = TlsAlloc(); - once = 1; - if (tlsKey == TLS_OUT_OF_INDEXES) { - Tcl_Panic("could not allocate thread local storage"); - } - } - result = TlsGetValue(tlsKey); if ((result == NULL) && (GetLastError() != NO_ERROR)) { Tcl_Panic("TlsGetValue failed from TclpGetAllocCache"); @@ -1021,7 +1020,7 @@ TclpFreeAllocCache( if (!success) { Tcl_Panic("TlsSetValue failed from TclpFreeAllocCache"); } - } else if (once) { + } else { /* * Called by us in TclFinalizeThreadAlloc() during the library * finalization initiated from Tcl_Finalize() @@ -1031,9 +1030,7 @@ TclpFreeAllocCache( if (!success) { Tcl_Panic("TlsFree failed from TclpFreeAllocCache"); } - once = 0; /* reset for next time. */ } - } #endif /* USE_THREAD_ALLOC */ |