Diff
Not logged in

Differences From Artifact [76f8f042a6]:

To Artifact [02f342abd3]:


676
677
678
679
680
681
682
683
684
685
686
687
688
689
690

#ifdef TCL_THREADS
/*
 * Additions by AOL for specialized thread memory allocator.
 */

#ifdef USE_THREAD_ALLOC
static volatile int initialized = 0;
static pthread_key_t key;

typedef struct allocMutex {
    Tcl_Mutex tlock;
    pthread_mutex_t plock;
} allocMutex;








<







676
677
678
679
680
681
682

683
684
685
686
687
688
689

#ifdef TCL_THREADS
/*
 * Additions by AOL for specialized thread memory allocator.
 */

#ifdef USE_THREAD_ALLOC

static pthread_key_t key;

typedef struct allocMutex {
    Tcl_Mutex tlock;
    pthread_mutex_t plock;
} allocMutex;

723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740







741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
    if (ptr != NULL) {
	/*
	 * Called by the pthread lib when a thread exits
	 */

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

    } else if (initialized) {
	/*
	 * Called by us in TclFinalizeThreadAlloc() during the library
	 * finalization initiated from Tcl_Finalize()
	 */

	pthread_key_delete(key);
	initialized = 0;
    }
}








void *
TclpGetAllocCache(void)
{
    if (!initialized) {
	pthread_mutex_lock(allocLockPtr);
	if (!initialized) {
	    pthread_key_create(&key, TclpFreeAllocCache);
	    initialized = 1;
	}
	pthread_mutex_unlock(allocLockPtr);
    }
    return pthread_getspecific(key);
}

void
TclpSetAllocCache(
    void *arg)
{







|
|
<
|
<
<
|
<
<
|
|
>
>
>
>
>
>
>




<
<
<
<
<
<
<
<







722
723
724
725
726
727
728
729
730

731


732


733
734
735
736
737
738
739
740
741
742
743
744
745








746
747
748
749
750
751
752
    if (ptr != NULL) {
	/*
	 * Called by the pthread lib when a thread exits
	 */

	TclFreeAllocCache(ptr);
	pthread_setspecific(key, NULL);
	
    } else {

	pthread_key_delete(key);


    }


}

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

void *
TclpGetAllocCache(void)
{








    return pthread_getspecific(key);
}

void
TclpSetAllocCache(
    void *arg)
{