summaryrefslogtreecommitdiff
path: root/src/gc/handletablecache.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gc/handletablecache.cpp')
-rw-r--r--src/gc/handletablecache.cpp26
1 files changed, 13 insertions, 13 deletions
diff --git a/src/gc/handletablecache.cpp b/src/gc/handletablecache.cpp
index 717348fdb4..33cc08e82f 100644
--- a/src/gc/handletablecache.cpp
+++ b/src/gc/handletablecache.cpp
@@ -86,7 +86,7 @@ void SpinUntil(void *pCond, BOOL fNonZero)
#endif //_DEBUG
// sleep for a little while
- __SwitchToThread(dwThisSleepPeriod, CALLER_LIMITS_SPINNING);
+ GCToOSInterface::Sleep(dwThisSleepPeriod);
// now update our sleep period
dwThisSleepPeriod = dwNextSleepPeriod;
@@ -471,7 +471,7 @@ void TableFullRebalanceCache(HandleTable *pTable,
// update the write index for the free bank
// NOTE: we use an interlocked exchange here to guarantee relative store order on MP
// AFTER THIS POINT THE FREE BANK IS LIVE AND COULD RECEIVE NEW HANDLES
- FastInterlockExchange((LONG*)&pCache->lFreeIndex, lMinFreeIndex);
+ Interlocked::Exchange(&pCache->lFreeIndex, lMinFreeIndex);
// now if we have any handles left, store them in the reserve bank
if (uHandleCount)
@@ -488,7 +488,7 @@ void TableFullRebalanceCache(HandleTable *pTable,
// update the read index for the reserve bank
// NOTE: we use an interlocked exchange here to guarantee relative store order on MP
// AT THIS POINT THE RESERVE BANK IS LIVE AND HANDLES COULD BE ALLOCATED FROM IT
- FastInterlockExchange((LONG*)&pCache->lReserveIndex, lMinReserveIndex);
+ Interlocked::Exchange(&pCache->lReserveIndex, lMinReserveIndex);
}
@@ -599,12 +599,12 @@ void TableQuickRebalanceCache(HandleTable *pTable,
// update the write index for the free bank
// NOTE: we use an interlocked exchange here to guarantee relative store order on MP
// AFTER THIS POINT THE FREE BANK IS LIVE AND COULD RECEIVE NEW HANDLES
- FastInterlockExchange((LONG*)&pCache->lFreeIndex, lMinFreeIndex);
+ Interlocked::Exchange(&pCache->lFreeIndex, lMinFreeIndex);
// update the read index for the reserve bank
// NOTE: we use an interlocked exchange here to guarantee relative store order on MP
// AT THIS POINT THE RESERVE BANK IS LIVE AND HANDLES COULD BE ALLOCATED FROM IT
- FastInterlockExchange((LONG*)&pCache->lReserveIndex, lMinReserveIndex);
+ Interlocked::Exchange(&pCache->lReserveIndex, lMinReserveIndex);
}
@@ -630,13 +630,13 @@ OBJECTHANDLE TableCacheMissOnAlloc(HandleTable *pTable, HandleTypeCache *pCache,
CrstHolder ch(&pTable->Lock);
// try again to take a handle (somebody else may have rebalanced)
- int32_t lReserveIndex = FastInterlockDecrement((LONG*)&pCache->lReserveIndex);
+ int32_t lReserveIndex = Interlocked::Decrement(&pCache->lReserveIndex);
// are we still waiting for handles?
if (lReserveIndex < 0)
{
// yup, suspend free list usage...
- int32_t lFreeIndex = FastInterlockExchange((LONG*)&pCache->lFreeIndex, 0L);
+ int32_t lFreeIndex = Interlocked::Exchange(&pCache->lFreeIndex, 0);
// ...and rebalance the cache...
TableQuickRebalanceCache(pTable, pCache, uType, lReserveIndex, lFreeIndex, &handle, NULL);
@@ -680,13 +680,13 @@ void TableCacheMissOnFree(HandleTable *pTable, HandleTypeCache *pCache, uint32_t
CrstHolder ch(&pTable->Lock);
// try again to take a slot (somebody else may have rebalanced)
- int32_t lFreeIndex = FastInterlockDecrement((LONG*)&pCache->lFreeIndex);
+ int32_t lFreeIndex = Interlocked::Decrement(&pCache->lFreeIndex);
// are we still waiting for free slots?
if (lFreeIndex < 0)
{
// yup, suspend reserve list usage...
- int32_t lReserveIndex = FastInterlockExchange((LONG*)&pCache->lReserveIndex, 0L);
+ int32_t lReserveIndex = Interlocked::Exchange(&pCache->lReserveIndex, 0);
// ...and rebalance the cache...
TableQuickRebalanceCache(pTable, pCache, uType, lReserveIndex, lFreeIndex, NULL, handle);
@@ -718,7 +718,7 @@ OBJECTHANDLE TableAllocSingleHandleFromCache(HandleTable *pTable, uint32_t uType
if (pTable->rgQuickCache[uType])
{
// try to grab the handle we saw
- handle = FastInterlockExchangePointer(pTable->rgQuickCache + uType, (OBJECTHANDLE)NULL);
+ handle = Interlocked::ExchangePointer(pTable->rgQuickCache + uType, (OBJECTHANDLE)NULL);
// if it worked then we're done
if (handle)
@@ -729,7 +729,7 @@ OBJECTHANDLE TableAllocSingleHandleFromCache(HandleTable *pTable, uint32_t uType
HandleTypeCache *pCache = pTable->rgMainCache + uType;
// try to take a handle from the main cache
- int32_t lReserveIndex = FastInterlockDecrement((LONG*)&pCache->lReserveIndex);
+ int32_t lReserveIndex = Interlocked::Decrement(&pCache->lReserveIndex);
// did we underflow?
if (lReserveIndex < 0)
@@ -787,7 +787,7 @@ void TableFreeSingleHandleToCache(HandleTable *pTable, uint32_t uType, OBJECTHAN
if (!pTable->rgQuickCache[uType])
{
// yup - try to stuff our handle in the slot we saw
- handle = FastInterlockExchangePointer(&pTable->rgQuickCache[uType], handle);
+ handle = Interlocked::ExchangePointer(&pTable->rgQuickCache[uType], handle);
// if we didn't end up with another handle then we're done
if (!handle)
@@ -798,7 +798,7 @@ void TableFreeSingleHandleToCache(HandleTable *pTable, uint32_t uType, OBJECTHAN
HandleTypeCache *pCache = pTable->rgMainCache + uType;
// try to take a free slot from the main cache
- int32_t lFreeIndex = FastInterlockDecrement((LONG*)&pCache->lFreeIndex);
+ int32_t lFreeIndex = Interlocked::Decrement(&pCache->lFreeIndex);
// did we underflow?
if (lFreeIndex < 0)