- Timestamp:
- Jun 14, 2009 6:37:44 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/generic/mempool-generic.cpp
r20360 r20561 159 159 RTDECL(int) RTMemPoolDestroy(RTMEMPOOL hMemPool) 160 160 { 161 162 return VERR_NOT_IMPLEMENTED; 163 } 164 161 if (hMemPool == NIL_RTMEMPOOL) 162 return VINF_SUCCESS; 163 PRTMEMPOOLINT pMemPool = hMemPool; 164 RTMEMPOOL_VALID_RETURN_RC(pMemPool, VERR_INVALID_HANDLE); 165 if (pMemPool == &g_rtMemPoolDefault) 166 return VINF_SUCCESS; 167 168 /* 169 * Invalidate the handle and free all associated resources. 170 */ 171 ASMAtomicWriteU32(&pMemPool->u32Magic, RTMEMPOOL_MAGIC_DEAD); 172 173 int rc = RTSpinlockDestroy(pMemPool->hSpinLock); AssertRC(rc); 174 pMemPool->hSpinLock = NIL_RTSPINLOCK; 175 176 PRTMEMPOOLENTRY pEntry = pMemPool->pHead; 177 pMemPool->pHead = NULL; 178 while (pEntry) 179 { 180 PRTMEMPOOLENTRY pFree = pEntry; 181 pEntry = pEntry->pNext; 182 183 pFree->pMemPool = NULL; 184 pFree->pNext = NULL; 185 pFree->pPrev = NULL; 186 pFree->cRefs = UINT32_MAX - 3; 187 RTMemFree(pFree); 188 } 189 190 RTMemFree(pMemPool); 191 192 return VINF_SUCCESS; 193 } 165 194 166 195 … … 353 382 { 354 383 rtMemPoolUnlink(pEntry); 384 pEntry->cRefs = UINT32_MAX - 2; 355 385 RTMemFree(pEntry); 356 386 }
Note:
See TracChangeset
for help on using the changeset viewer.