Check-in [bbfcd2c669]
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Fix [3cc1d91345]: duplicate calls to TclpFreeAllocCache() on thread exists
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: bbfcd2c669c7db399b0629bb61f5310666c2596e
User & Date: jan.nijtmans 2016-10-11 21:52:57.236
Context
2016-10-12
09:58
[74bc0e44f5] Doc tweak. check-in: 238be90a8b user: dkf tags: trunk
2016-10-11
21:53
merge trunk check-in: d5f3db4df2 user: jan.nijtmans tags: novem
21:52
Fix [3cc1d91345]: duplicate calls to TclpFreeAllocCache() on thread exists check-in: bbfcd2c669 user: jan.nijtmans tags: trunk
21:43
Fix [3cc1d91345]: duplicate calls to TclpFreeAllocCache() on thread exists check-in: 7a3c8a4b0d user: jan.nijtmans tags: core-8-6-branch
2016-10-09
16:02
[62b36e326c] Noted edge case in behaviour of [concat] with empty arguments. check-in: 53cdc09f00 user: dkf tags: trunk
Changes
Unified Diff Ignore Whitespace Patch
Changes to generic/tclThreadAlloc.c.
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
}

/*
 *----------------------------------------------------------------------
 *
 * TclFinalizeThreadAllocThread --
 *
 *	This procedure is used to destroy single thread private resources used
 *	in this file.
 * Called in TclpFinalizeThreadData when a thread exits (Tcl_FinalizeThread).
 *
 * Results:
 *	None.
 *
 * Side effects:
 *	None.
 *







|
|
|







1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
}

/*
 *----------------------------------------------------------------------
 *
 * TclFinalizeThreadAllocThread --
 *
 *	This procedure is used to destroy single thread private resources
 *	defined in this file. Called either during Tcl_FinalizeThread() or
 *	Tcl_Finalize().
 *
 * Results:
 *	None.
 *
 * Side effects:
 *	None.
 *
Changes to unix/tclUnixInit.c.
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
#if MAC_OS_X_VERSION_MAX_ALLOWED > 1020
    /*
     * Set msgcat fallback locale to current CFLocale identifier.
     */

    CFLocaleRef localeRef;

    if (CFLocaleCopyCurrent != NULL && CFLocaleGetIdentifier != NULL &&
	    (localeRef = CFLocaleCopyCurrent())) {
	CFStringRef locale = CFLocaleGetIdentifier(localeRef);

	if (locale) {
	    char loc[256];

	    if (CFStringGetCString(locale, loc, 256, kCFStringEncodingUTF8)) {







|







757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
#if MAC_OS_X_VERSION_MAX_ALLOWED > 1020
    /*
     * Set msgcat fallback locale to current CFLocale identifier.
     */

    CFLocaleRef localeRef;

    if (&CFLocaleCopyCurrent != NULL && &CFLocaleGetIdentifier != NULL &&
	    (localeRef = CFLocaleCopyCurrent())) {
	CFStringRef locale = CFLocaleGetIdentifier(localeRef);

	if (locale) {
	    char loc[256];

	    if (CFStringGetCString(locale, loc, 256, kCFStringEncodingUTF8)) {
Changes to unix/tclUnixSock.c.
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
        }
        if (retry >= MAXRETRY) {
            goto error;
        }
    }
    retry++;
    chosenport = 0;
    
    if (!TclCreateSocketAddress(interp, &addrlist, myHost, port, 1, &errorMsg)) {
	my_errno = errno;
	goto error;
    }

    for (addrPtr = addrlist; addrPtr != NULL; addrPtr = addrPtr->ai_next) {
	sock = socket(addrPtr->ai_family, addrPtr->ai_socktype,







|







1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
        }
        if (retry >= MAXRETRY) {
            goto error;
        }
    }
    retry++;
    chosenport = 0;

    if (!TclCreateSocketAddress(interp, &addrlist, myHost, port, 1, &errorMsg)) {
	my_errno = errno;
	goto error;
    }

    for (addrPtr = addrlist; addrPtr != NULL; addrPtr = addrPtr->ai_next) {
	sock = socket(addrPtr->ai_family, addrPtr->ai_socktype,
Changes to unix/tclUnixThrd.c.
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725

726
727
728
729
730
731





732
733
734
735
736
737
738
    free(lockPtr);
}

void
TclpInitAllocCache(void)
{
    pthread_mutex_lock(allocLockPtr);
    pthread_key_create(&key, TclpFreeAllocCache);
    pthread_mutex_unlock(allocLockPtr);
}

void
TclpFreeAllocCache(
    void *ptr)
{
    if (ptr != NULL) {
	/*
	 * Called by the pthread lib when a thread exits

	 */

	TclFreeAllocCache(ptr);
	pthread_setspecific(key, NULL);

    } else {





	pthread_key_delete(key);
    }
}

void *
TclpGetAllocCache(void)
{







|









|
>






>
>
>
>
>







708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
    free(lockPtr);
}

void
TclpInitAllocCache(void)
{
    pthread_mutex_lock(allocLockPtr);
    pthread_key_create(&key, NULL);
    pthread_mutex_unlock(allocLockPtr);
}

void
TclpFreeAllocCache(
    void *ptr)
{
    if (ptr != NULL) {
	/*
	 * Called by TclFinalizeThreadAllocThread() during the thread
	 * finalization initiated from Tcl_FinalizeThread()
	 */

	TclFreeAllocCache(ptr);
	pthread_setspecific(key, NULL);

    } else {
	/*
	 * Called by TclFinalizeThreadAlloc() during the process
	 * finalization initiated from Tcl_Finalize()
	 */

	pthread_key_delete(key);
    }
}

void *
TclpGetAllocCache(void)
{
Changes to win/tclWinThrd.c.
1004
1005
1006
1007
1008
1009
1010
1011


1012
1013
1014
1015
1016
1017
1018
1019
TclpFreeAllocCache(
    void *ptr)
{
    BOOL success;

    if (ptr != NULL) {
	/*
	 * Called by us in TclpFinalizeThreadData when a thread exits and


	 * destroys the tsd key which stores allocator caches.
	 */

	TclFreeAllocCache(ptr);
	success = TlsSetValue(tlsKey, NULL);
	if (!success) {
	    Tcl_Panic("TlsSetValue failed from TclpFreeAllocCache");
	}







|
>
>
|







1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
TclpFreeAllocCache(
    void *ptr)
{
    BOOL success;

    if (ptr != NULL) {
	/*
	 * Called by TclFinalizeThreadAlloc() and
	 * TclFinalizeThreadAllocThread() during Tcl_Finalize() or
	 * Tcl_FinalizeThread(). This function destroys the tsd key which
	 * stores allocator caches in thread local storage.
	 */

	TclFreeAllocCache(ptr);
	success = TlsSetValue(tlsKey, NULL);
	if (!success) {
	    Tcl_Panic("TlsSetValue failed from TclpFreeAllocCache");
	}