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
|
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, TclpFreeAllocCache);
pthread_key_create(&key, NULL);
pthread_mutex_unlock(allocLockPtr);
}
void
TclpFreeAllocCache(
void *ptr)
{
if (ptr != NULL) {
/*
* Called by the pthread lib when a thread exits
* 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)
{
|