Changeset 101976 in vbox for trunk/src/libs/xpcom18a4
- Timestamp:
- Nov 8, 2023 1:38:41 PM (15 months ago)
- Location:
- trunk/src/libs/xpcom18a4/xpcom/components
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/libs/xpcom18a4/xpcom/components/nsCategoryManager.cpp
r1 r101976 58 58 #include "nsEnumeratorUtils.h" 59 59 60 #include <iprt/assert.h> 61 #include <iprt/errcore.h> 62 60 63 class nsIComponentLoaderManager; 61 64 … … 216 219 } 217 220 218 node->mLock = PR_NewLock(); 219 if (!node->mLock) { 221 node->mLock = NIL_RTSEMFASTMUTEX; 222 int vrc = RTSemFastMutexCreate(&node->mLock); 223 if (RT_FAILURE(vrc)) { 220 224 delete node; 221 225 return nsnull; … … 227 231 CategoryNode::~CategoryNode() 228 232 { 229 if (mLock) 230 PR_DestroyLock(mLock); 233 if (mLock != NIL_RTSEMFASTMUTEX) 234 { 235 RTSemFastMutexDestroy(mLock); 236 mLock = NIL_RTSEMFASTMUTEX; 237 } 231 238 } 232 239 … … 243 250 char** _retval) 244 251 { 245 PR_Lock(mLock);252 RTSemFastMutexRequest(mLock); 246 253 nsresult rv = NS_ERROR_NOT_AVAILABLE; 247 254 CategoryLeaf* ent = … … 254 261 rv = NS_OK; 255 262 } 256 PR_Unlock(mLock);263 RTSemFastMutexRelease(mLock); 257 264 258 265 return rv; … … 267 274 PLArenaPool* aArena) 268 275 { 269 PR_Lock(mLock);276 RTSemFastMutexRequest(mLock); 270 277 CategoryLeaf* leaf = 271 278 mTable.GetEntry(aEntryName); … … 298 305 } 299 306 300 PR_Unlock(mLock);307 RTSemFastMutexRelease(mLock); 301 308 return rv; 302 309 } … … 308 315 // we don't throw any errors, because it normally doesn't matter 309 316 // and it makes JS a lot cleaner 310 PR_Lock(mLock);317 RTSemFastMutexRequest(mLock); 311 318 312 319 if (aDontPersist) { … … 326 333 } 327 334 } 328 PR_Unlock(mLock);335 RTSemFastMutexRelease(mLock); 329 336 330 337 return NS_OK; … … 336 343 NS_ENSURE_ARG_POINTER(_retval); 337 344 338 PR_Lock(mLock);345 RTSemFastMutexRequest(mLock); 339 346 EntryEnumerator* enumObj = EntryEnumerator::Create(mTable); 340 PR_Unlock(mLock);347 RTSemFastMutexRelease(mLock); 341 348 342 349 if (!enumObj) … … 385 392 }; 386 393 387 PR_Lock(mLock);394 RTSemFastMutexRequest(mLock); 388 395 mTable.EnumerateEntries(enumfunc_pentries, &args); 389 PR_Unlock(mLock);396 RTSemFastMutexRelease(mLock); 390 397 391 398 return args.success; … … 463 470 } 464 471 465 manager->mLock = PR_NewLock(); 466 467 if (!manager->mLock) { 472 manager->mLock = NIL_RTSEMFASTMUTEX; 473 int vrc = RTSemFastMutexCreate(&manager->mLock); 474 if (RT_FAILURE(vrc)) 475 { 468 476 delete manager; 469 477 return nsnull; … … 475 483 nsCategoryManager::~nsCategoryManager() 476 484 { 477 if (mLock) 478 PR_DestroyLock(mLock); 485 if (mLock != NIL_RTSEMFASTMUTEX) 486 { 487 RTSemFastMutexDestroy(mLock); 488 mLock = NIL_RTSEMFASTMUTEX; 489 } 479 490 480 491 // the hashtable contains entries that must be deleted before the arena is … … 506 517 nsresult status = NS_ERROR_NOT_AVAILABLE; 507 518 508 PR_Lock(mLock);519 RTSemFastMutexRequest(mLock); 509 520 CategoryNode* category = get_category(aCategoryName); 510 PR_Unlock(mLock);521 RTSemFastMutexRelease(mLock); 511 522 512 523 if (category) { … … 531 542 // Before we can insert a new entry, we'll need to 532 543 // find the |CategoryNode| to put it in... 533 PR_Lock(mLock);544 RTSemFastMutexRequest(mLock); 534 545 CategoryNode* category = get_category(aCategoryName); 535 546 … … 541 552 mTable.Put(categoryName, category); 542 553 } 543 PR_Unlock(mLock);554 RTSemFastMutexRelease(mLock); 544 555 545 556 if (!category) … … 568 579 */ 569 580 570 PR_Lock(mLock);581 RTSemFastMutexRequest(mLock); 571 582 CategoryNode* category = get_category(aCategoryName); 572 PR_Unlock(mLock);583 RTSemFastMutexRelease(mLock); 573 584 574 585 if (!category) … … 588 599 // leaf nodes. 589 600 590 PR_Lock(mLock);601 RTSemFastMutexRequest(mLock); 591 602 CategoryNode* category = get_category(aCategoryName); 592 PR_Unlock(mLock);603 RTSemFastMutexRelease(mLock); 593 604 594 605 if (category) … … 605 616 NS_ENSURE_ARG_POINTER(_retval); 606 617 607 PR_Lock(mLock);618 RTSemFastMutexRequest(mLock); 608 619 CategoryNode* category = get_category(aCategoryName); 609 PR_Unlock(mLock);620 RTSemFastMutexRelease(mLock); 610 621 611 622 if (!category) { … … 621 632 NS_ENSURE_ARG_POINTER(_retval); 622 633 623 PR_Lock(mLock);634 RTSemFastMutexRequest(mLock); 624 635 CategoryEnumerator* enumObj = CategoryEnumerator::Create(mTable); 625 PR_Unlock(mLock);636 RTSemFastMutexRelease(mLock); 626 637 627 638 if (!enumObj) … … 661 672 }; 662 673 663 PR_Lock(mLock);674 RTSemFastMutexRequest(mLock); 664 675 mTable.EnumerateRead(enumfunc_categories, &args); 665 PR_Unlock(mLock);676 RTSemFastMutexRelease(mLock); 666 677 667 678 if (!args.success) { -
trunk/src/libs/xpcom18a4/xpcom/components/nsCategoryManager.h
r62333 r101976 41 41 42 42 #include "prio.h" 43 #include "prlock.h"44 43 #include "plarena.h" 45 44 #include "nsClassHashtable.h" 46 45 #include "nsICategoryManager.h" 46 47 #include <iprt/semaphore.h> 47 48 48 49 #define NS_CATEGORYMANAGER_CLASSNAME "Category Manager" … … 95 96 96 97 void Clear() { 97 PR_Lock(mLock);98 RTSemFastMutexRequest(mLock); 98 99 mTable.Clear(); 99 PR_Unlock(mLock);100 RTSemFastMutexRelease(mLock); 100 101 } 101 102 102 103 PRUint32 Count() { 103 PR_Lock(mLock);104 RTSemFastMutexRequest(mLock); 104 105 PRUint32 tCount = mTable.Count(); 105 PR_Unlock(mLock);106 RTSemFastMutexRelease(mLock); 106 107 return tCount; 107 108 } … … 121 122 122 123 nsTHashtable<CategoryLeaf> mTable; 123 PRLock*mLock;124 RTSEMFASTMUTEX mLock; 124 125 }; 125 126 … … 154 155 PLArenaPool mArena; 155 156 nsClassHashtable<nsDepCharHashKey, CategoryNode> mTable; 156 PRLock*mLock;157 RTSEMFASTMUTEX mLock; 157 158 }; 158 159
Note:
See TracChangeset
for help on using the changeset viewer.