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
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 volatile int initialized = 0;
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
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 if (initialized) {
	
    } else {
	/*
	 * Called by us in TclFinalizeThreadAlloc() during the library
	pthread_key_delete(key);
	 * finalization initiated from Tcl_Finalize()
	 */

    }
	pthread_key_delete(key);
	initialized = 0;
    }
}
}

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

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)
{