Changeset 101975 in vbox for trunk/src/libs/xpcom18a4
- Timestamp:
- Nov 8, 2023 1:31:55 PM (15 months ago)
- Location:
- trunk/src/libs/xpcom18a4/xpcom
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/libs/xpcom18a4/xpcom/base/nsTraceRefcntImpl.cpp
r101828 r101975 101 101 #include "prmem.h" 102 102 103 #include "prlock.h" 104 105 static PRLock* gTraceLock; 106 107 #define LOCK_TRACELOG() PR_Lock(gTraceLock) 108 #define UNLOCK_TRACELOG() PR_Unlock(gTraceLock) 103 #include <iprt/assert.h> 104 #include <iprt/errcore.h> 105 #include <iprt/semaphore.h> 106 107 static RTSEMFASTMUTEX gTraceLock = NIL_RTSEMFASTMUTEX; 108 109 #define LOCK_TRACELOG() RTSemFastMutexRequest(gTraceLock) 110 #define UNLOCK_TRACELOG() RTSemFastMutexRelease(gTraceLock) 109 111 110 112 static PLHashTable* gBloatView; … … 828 830 } 829 831 830 gTraceLock = PR_NewLock(); 832 int vrc = RTSemFastMutexCreate(&gTraceLock); 833 AssertRC(vrc); RT_NOREF(vrc); 831 834 } 832 835 -
trunk/src/libs/xpcom18a4/xpcom/ds/nsBaseHashtable.h
r40023 r101975 40 40 41 41 #include "nsTHashtable.h" 42 #include "prlock.h"43 42 #include "nsDebug.h" 43 44 #include <iprt/assert.h> 45 #include <iprt/errcore.h> 46 #include <iprt/semaphore.h> 44 47 45 48 template<class KeyClass,class DataType,class UserDataType> … … 291 294 292 295 protected: 293 PRLock*mLock;296 RTSEMFASTMUTEX mLock; 294 297 }; 295 298 … … 358 361 nsBaseHashtableMT<KeyClass,DataType,UserDataType>::~nsBaseHashtableMT() 359 362 { 360 if (this->mLock) 361 PR_DestroyLock(this->mLock); 363 if (this->mLock != NIL_RTSEMFASTMUTEX) 364 { 365 RTSemFastMutexDestroy(this->mLock); 366 this->mLock = NIL_RTSEMFASTMUTEX; 367 } 362 368 } 363 369 … … 369 375 return PR_FALSE; 370 376 371 this->mLock = PR_NewLock(); 372 NS_WARN_IF_FALSE(this->mLock, "Error creating lock during nsBaseHashtableL::Init()"); 373 374 return (this->mLock != nsnull); 377 this->mLock = NIL_RTSEMFASTMUTEX; 378 int vrc = RTSemFastMutexCreate(&this->mLock); 379 NS_WARN_IF_FALSE(RT_SUCCESS(vrc), "Error creating lock during nsBaseHashtableL::Init()"); 380 381 return (this->mLock != NIL_RTSEMFASTMUTEX); 375 382 } 376 383 … … 379 386 nsBaseHashtableMT<KeyClass,DataType,UserDataType>::Count() const 380 387 { 381 PR_Lock(this->mLock);388 RTSemFastMutexRequest(this->mLock); 382 389 PRUint32 count = nsTHashtable<EntryType>::Count(); 383 PR_Unlock(this->mLock);390 RTSemFastMutexRelease(this->mLock); 384 391 385 392 return count; … … 391 398 UserDataType* pData) const 392 399 { 393 PR_Lock(this->mLock);400 RTSemFastMutexRequest(this->mLock); 394 401 PRBool res = 395 402 nsBaseHashtable<KeyClass,DataType,UserDataType>::Get(aKey, pData); 396 PR_Unlock(this->mLock);403 RTSemFastMutexRelease(this->mLock); 397 404 398 405 return res; … … 404 411 UserDataType aData) 405 412 { 406 PR_Lock(this->mLock);413 RTSemFastMutexRequest(this->mLock); 407 414 PRBool res = 408 415 nsBaseHashtable<KeyClass,DataType,UserDataType>::Put(aKey, aData); 409 PR_Unlock(this->mLock);416 RTSemFastMutexRelease(this->mLock); 410 417 411 418 return res; … … 416 423 nsBaseHashtableMT<KeyClass,DataType,UserDataType>::Remove(KeyType aKey) 417 424 { 418 PR_Lock(this->mLock);425 RTSemFastMutexRequest(this->mLock); 419 426 nsBaseHashtable<KeyClass,DataType,UserDataType>::Remove(aKey); 420 PR_Unlock(this->mLock);427 RTSemFastMutexRelease(this->mLock); 421 428 } 422 429 … … 426 433 (EnumReadFunction fEnumCall, void* userArg) const 427 434 { 428 PR_Lock(this->mLock);435 RTSemFastMutexRequest(this->mLock); 429 436 PRUint32 count = 430 437 nsBaseHashtable<KeyClass,DataType,UserDataType>::EnumerateRead(fEnumCall, userArg); 431 PR_Unlock(this->mLock);438 RTSemFastMutexRelease(this->mLock); 432 439 433 440 return count; … … 439 446 (EnumFunction fEnumCall, void* userArg) 440 447 { 441 PR_Lock(this->mLock);448 RTSemFastMutexRequest(this->mLock); 442 449 PRUint32 count = 443 450 nsBaseHashtable<KeyClass,DataType,UserDataType>::Enumerate(fEnumCall, userArg); 444 PR_Unlock(this->mLock);451 RTSemFastMutexRelease(this->mLock); 445 452 446 453 return count; … … 451 458 nsBaseHashtableMT<KeyClass,DataType,UserDataType>::Clear() 452 459 { 453 PR_Lock(this->mLock);460 RTSemFastMutexRequest(this->mLock); 454 461 nsBaseHashtable<KeyClass,DataType,UserDataType>::Clear(); 455 PR_Unlock(this->mLock);462 RTSemFastMutexRelease(this->mLock); 456 463 } 457 464 -
trunk/src/libs/xpcom18a4/xpcom/ds/nsClassHashtable.h
r40023 r101975 124 124 nsClassHashtableMT<KeyClass,T>::Get(KeyType aKey, T** retVal) const 125 125 { 126 PR_Lock(this->mLock);126 RTSemFastMutexRequest(this->mLock); 127 127 128 128 typename nsBaseHashtableMT<KeyClass,nsAutoPtr<T>,T*>::EntryType* ent = … … 134 134 *retVal = ent->mData; 135 135 136 PR_Unlock(this->mLock);136 RTSemFastMutexRelease(this->mLock); 137 137 138 138 return PR_TRUE; … … 142 142 *retVal = nsnull; 143 143 144 PR_Unlock(this->mLock);144 RTSemFastMutexRelease(this->mLock); 145 145 146 146 return PR_FALSE; -
trunk/src/libs/xpcom18a4/xpcom/ds/nsHashtable.cpp
r1 r101975 56 56 #include "nsCRT.h" 57 57 58 #include <iprt/assert.h> 59 #include <iprt/errcore.h> 60 58 61 struct HTEntry : PLDHashEntryHdr 59 62 { … … 169 172 if (!result) 170 173 mHashtable.ops = nsnull; 171 172 if (threadSafe) {173 mLock = PR_NewLock();174 if (mLock == NULL){175 // Cannot create a lock. If running on a multiprocessing system176 // we are sure to die.177 PR_ASSERT(mLock != NULL);178 }174 175 mLock = NIL_RTSEMFASTMUTEX; 176 if (threadSafe) 177 { 178 int vrc = RTSemFastMutexCreate(&mLock); 179 // Cannot create a lock. If running on a multiprocessing system 180 // we are sure to die. 181 AssertReleaseRC(vrc); 179 182 } 180 183 } … … 185 188 if (mHashtable.ops) 186 189 PL_DHashTableFinish(&mHashtable); 187 if (mLock) PR_DestroyLock(mLock); 190 if (mLock != NIL_RTSEMFASTMUTEX) 191 { 192 int vrc = RTSemFastMutexDestroy(mLock); 193 AssertRC(vrc); 194 } 188 195 } 189 196 190 197 PRBool nsHashtable::Exists(nsHashKey *aKey) 191 198 { 192 if (mLock) PR_Lock(mLock);199 if (mLock) RTSemFastMutexRequest(mLock); 193 200 194 201 if (!mHashtable.ops) … … 200 207 PRBool exists = PL_DHASH_ENTRY_IS_BUSY(entry); 201 208 202 if (mLock) PR_Unlock(mLock);209 if (mLock) RTSemFastMutexRelease(mLock); 203 210 204 211 return exists; … … 211 218 if (!mHashtable.ops) return nsnull; 212 219 213 if (mLock) PR_Lock(mLock);220 if (mLock) RTSemFastMutexRequest(mLock); 214 221 215 222 // shouldn't be adding an item during enumeration … … 232 239 } 233 240 234 if (mLock) PR_Unlock(mLock);241 if (mLock) RTSemFastMutexRelease(mLock); 235 242 236 243 return res; … … 241 248 if (!mHashtable.ops) return nsnull; 242 249 243 if (mLock) PR_Lock(mLock);250 if (mLock) RTSemFastMutexRequest(mLock); 244 251 245 252 HTEntry* entry = … … 248 255 void *ret = PL_DHASH_ENTRY_IS_BUSY(entry) ? entry->value : nsnull; 249 256 250 if (mLock) PR_Unlock(mLock);257 if (mLock) RTSemFastMutexRelease(mLock); 251 258 252 259 return ret; … … 257 264 if (!mHashtable.ops) return nsnull; 258 265 259 if (mLock) PR_Lock(mLock);266 if (mLock) RTSemFastMutexRequest(mLock); 260 267 261 268 // shouldn't be adding an item during enumeration … … 278 285 } 279 286 280 if (mLock) PR_Unlock(mLock);287 if (mLock) RTSemFastMutexRelease(mLock); 281 288 282 289 return res; … … 367 374 nsresult rv = aStream->ReadBoolean(&threadSafe); 368 375 if (NS_SUCCEEDED(rv)) { 369 if (threadSafe) { 370 mLock = PR_NewLock(); 371 if (!mLock) 376 if (threadSafe) 377 { 378 int vrc = RTSemFastMutexCreate(&mLock); 379 if (RT_FAILURE(vrc)) 372 380 rv = NS_ERROR_OUT_OF_MEMORY; 373 381 } -
trunk/src/libs/xpcom18a4/xpcom/ds/nsHashtable.h
r1 r101975 55 55 56 56 #include "pldhash.h" 57 #include "prlock.h"58 57 #include "nscore.h" 59 58 #include "nsString.h" 60 59 #include "nsISupportsBase.h" 61 60 #include "nsTraceRefcnt.h" 61 62 #include <iprt/semaphore.h> 62 63 63 64 class nsIObjectInputStream; … … 135 136 protected: 136 137 // members 137 PRLock*mLock;138 RTSEMFASTMUTEX mLock; 138 139 PLDHashTable mHashtable; 139 140 PRBool mEnumerating; -
trunk/src/libs/xpcom18a4/xpcom/ds/nsInterfaceHashtable.h
r40023 r101975 165 165 (KeyType aKey, UserDataType* pInterface) const 166 166 { 167 PR_Lock(this->mLock);167 RTSemFastMutexRequest(this->mLock); 168 168 169 169 typename nsBaseHashtableMT<KeyClass, nsCOMPtr<Interface>, Interface*>::EntryType* ent = … … 179 179 } 180 180 181 PR_Unlock(this->mLock);181 RTSemFastMutexRelease(this->mLock); 182 182 183 183 return PR_TRUE; … … 189 189 *pInterface = nsnull; 190 190 191 PR_Unlock(this->mLock);191 RTSemFastMutexRelease(this->mLock); 192 192 193 193 return PR_FALSE;
Note:
See TracChangeset
for help on using the changeset viewer.