summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormig <mig>2011-03-19 17:56:06 (GMT)
committermig <mig>2011-03-19 17:56:06 (GMT)
commitad01c2a5d674e9304c376a1872a4ec39e03972b8 (patch)
treea0870be4c2402db46b2ad0b9d5805a82e20ce539
parent7594338af93c41ff22ddc17d9172d97b4a376d6c (diff)
downloadtcl-ad01c2a5d674e9304c376a1872a4ec39e03972b8.zip
tcl-ad01c2a5d674e9304c376a1872a4ec39e03972b8.tar.gz
tcl-ad01c2a5d674e9304c376a1872a4ec39e03972b8.tar.bz2
look at all blocks in this thread before looking in the shared cache
-rw-r--r--generic/tclAlloc.c24
1 files changed, 16 insertions, 8 deletions
diff --git a/generic/tclAlloc.c b/generic/tclAlloc.c
index f5fe3ee..efaf6ac 100644
--- a/generic/tclAlloc.c
+++ b/generic/tclAlloc.c
@@ -1230,20 +1230,28 @@ GetBlocks(
cachePtr->buckets[n].firstPtr = blockPtr->nextBlock;
cachePtr->buckets[n].numFree--;
break;
- } else if (sharedPtr->buckets[n].numFree > 0){
- LockBucket(cachePtr, n);
+ }
+ }
+#if defined(TCL_THREADS)
+ if (blockPtr == NULL) {
+ n = nBuckets;
+ size = 0; /* lint */
+ while (--n > bucket) {
if (sharedPtr->buckets[n].numFree > 0) {
- blockPtr = sharedPtr->buckets[n].firstPtr;
- sharedPtr->buckets[n].firstPtr = blockPtr->nextBlock;
- sharedPtr->buckets[n].numFree--;
+ LockBucket(cachePtr, n);
+ if (sharedPtr->buckets[n].numFree > 0) {
+ blockPtr = sharedPtr->buckets[n].firstPtr;
+ sharedPtr->buckets[n].firstPtr = blockPtr->nextBlock;
+ sharedPtr->buckets[n].numFree--;
+ UnlockBucket(cachePtr, n);
+ break;
+ }
UnlockBucket(cachePtr, n);
- break;
}
- UnlockBucket(cachePtr, n);
}
}
#endif
-
+#endif
/*
* Otherwise, allocate a big new block directly.
*/