VirtualBox

Changeset 101923 in vbox


Ignore:
Timestamp:
Nov 7, 2023 10:10:19 AM (15 months ago)
Author:
vboxsync
Message:

libs/xpcom/java: Convert to use RTSEMFASTMUTEX for locking, bugref:10545

Location:
trunk/src/libs/xpcom18a4/java/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/libs/xpcom18a4/java/src/nsJavaXPCOMBindingUtils.cpp

    r56603 r101923  
    105105
    106106PRBool gJavaXPCOMInitialized = PR_FALSE;
    107 PRLock* gJavaXPCOMLock = nsnull;
     107RTSEMFASTMUTEX gJavaXPCOMLock = NIL_RTSEMFASTMUTEX;
    108108
    109109static const char* kJavaKeywords[] = {
     
    145145    return PR_TRUE;
    146146
     147  int vrc = VINF_SUCCESS;
     148
    147149  // Save pointer to JavaVM, which is valid across threads.
    148150  jint rc = env->GetJavaVM(&gCachedJVM);
     
    339341  }
    340342
    341   gJavaXPCOMLock = PR_NewLock();
     343  vrc = RTSemFastMutexCreate(&gJavaXPCOMLock);
     344  if (RT_FAILURE(vrc))
     345    goto init_error;
     346
    342347  gJavaXPCOMInitialized = PR_TRUE;
    343348  return PR_TRUE;
     
    356361FreeJavaGlobals(JNIEnv* env)
    357362{
    358   PRLock* tempLock = nsnull;
     363  RTSEMFASTMUTEX tempLock = NIL_RTSEMFASTMUTEX;
    359364  if (gJavaXPCOMLock) {
    360     PR_Lock(gJavaXPCOMLock);
     365    RTSemFastMutexRequest(gJavaXPCOMLock);
    361366
    362367    // null out global lock so no one else can use it
    363368    tempLock = gJavaXPCOMLock;
    364     gJavaXPCOMLock = nsnull;
     369    gJavaXPCOMLock = NIL_RTSEMFASTMUTEX;
    365370  }
    366371
     
    443448  }
    444449
    445   if (tempLock) {
    446     PR_Unlock(tempLock);
    447     PR_DestroyLock(tempLock);
     450  if (tempLock != NIL_RTSEMFASTMUTEX) {
     451    RTSemFastMutexRelease(tempLock);
     452    RTSemFastMutexDestroy(tempLock);
    448453  }
    449454}
  • trunk/src/libs/xpcom18a4/java/src/nsJavaXPCOMBindingUtils.h

    r29140 r101923  
    120120// finalizeProxy() function in nsJavaWrapper.cpp, we need to make sure that
    121121// all the structures touched by finalizeProxy() are multithread aware.
    122 extern PRLock* gJavaXPCOMLock;
     122extern RTSEMFASTMUTEX gJavaXPCOMLock;
    123123
    124124extern PRBool gJavaXPCOMInitialized;
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette