Changeset 97084 in vbox for trunk/src/VBox/NetworkServices
- Timestamp:
- Oct 11, 2022 6:51:17 AM (2 years ago)
- svn:sync-xref-src-repo-rev:
- 154035
- Location:
- trunk/src/VBox/NetworkServices/IntNetSwitch
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/NetworkServices/IntNetSwitch/IntNetSwitchInternal.h
r97058 r97084 36 36 * Header Files * 37 37 *********************************************************************************************************************************/ 38 #define IN_INTNET_TESTCASE 39 #define IN_INTNET_R3 40 38 41 #include <VBox/cdefs.h> 39 42 #include <VBox/types.h> … … 46 49 #define PSUPDRVSESSION MYPSUPDRVSESSION 47 50 51 #include <VBox/intnet.h> 48 52 #include <VBox/sup.h> 49 53 -
trunk/src/VBox/NetworkServices/IntNetSwitch/SrvIntNetWrapper.cpp
r97059 r97084 33 33 * Header Files * 34 34 *********************************************************************************************************************************/ 35 #define IN_INTNET_TESTCASE36 #define IN_INTNET_R337 38 35 #include "IntNetSwitchInternal.h" 39 36 40 41 #include <VBox/types.h>42 #include <VBox/intnet.h>43 37 #include <iprt/asm.h> 44 38 #include <iprt/mp.h> -
trunk/src/VBox/NetworkServices/IntNetSwitch/main.cpp
r97079 r97084 37 37 #include "IntNetSwitchInternal.h" 38 38 39 #include <VBox/intnet.h>40 39 #include <VBox/err.h> 41 40 #include <VBox/vmm/vmm.h> 42 41 #include <iprt/asm.h> 42 #include <iprt/critsect.h> 43 43 #include <iprt/initterm.h> 44 44 #include <iprt/mem.h> … … 55 55 * Structures and Typedefs * 56 56 *********************************************************************************************************************************/ 57 58 57 59 58 /** … … 98 97 /** Number of references to this service. */ 99 98 uint32_t volatile cRefs; 100 /** Mutexto serialize the initialization, usage counting and objects. */101 RT SEMFASTMUTEX hMtx;99 /** Critical section to serialize the initialization, usage counting and objects. */ 100 RTCRITSECT CritSect; 102 101 /** List of registered objects. Protected by the spinlock. */ 103 102 PSUPDRVOBJ volatile pObjs; … … 113 112 { 114 113 PSUPDRVDEVEXT pDevExt; 115 /** List of generic usage records. (protected by SUPDRVDEVEXT:: hMtx) */114 /** List of generic usage records. (protected by SUPDRVDEVEXT::CritSect) */ 116 115 PSUPDRVUSAGE volatile pUsage; 117 116 /** The XPC connection handle for this session. */ … … 158 157 159 158 PSUPDRVDEVEXT pDevExt = pSession->pDevExt; 160 RT SemFastMutexRequest(pDevExt->hMtx);159 RTCritSectEnter(&pDevExt->CritSect); 161 160 162 161 /* The object. */ … … 170 169 pSession->pUsage = pUsage; 171 170 172 RT SemFastMutexRelease(pDevExt->hMtx);171 RTCritSectLeave(&pDevExt->CritSect); 173 172 return pObj; 174 173 } … … 184 183 RT_NOREF(fNoBlocking); 185 184 186 RT SemFastMutexRequest(pDevExt->hMtx);185 RTCritSectEnter(&pDevExt->CritSect); 187 186 188 187 /* … … 220 219 } 221 220 222 RT SemFastMutexRelease(pDevExt->hMtx);221 RTCritSectLeave(&pDevExt->CritSect); 223 222 return rc; 224 223 } … … 242 241 * Acquire the spinlock and look for the usage record. 243 242 */ 244 RT SemFastMutexRequest(pDevExt->hMtx);243 RTCritSectEnter(&pDevExt->CritSect); 245 244 246 245 for (pUsagePrev = NULL, pUsage = pSession->pUsage; … … 296 295 } 297 296 298 RT SemFastMutexRelease(pDevExt->hMtx);297 RTCritSectLeave(&pDevExt->CritSect); 299 298 300 299 /* … … 380 379 { 381 380 PSUPDRVUSAGE pUsage; 382 RT SemFastMutexRequest(pDevExt->hMtx);381 RTCritSectEnter(&pDevExt->CritSect); 383 382 384 383 while ((pUsage = pSession->pUsage) != NULL) … … 409 408 } 410 409 410 RTCritSectLeave(&pDevExt->CritSect); 411 411 412 if (pObj->pfnDestructor) 412 413 pObj->pfnDestructor(pObj, pObj->pvUser1, pObj->pvUser2); 413 414 RTMemFree(pObj); 415 416 RTCritSectEnter(&pDevExt->CritSect); 414 417 } 415 418 … … 418 421 } 419 422 420 RT SemFastMutexRelease(pDevExt->hMtx);423 RTCritSectLeave(&pDevExt->CritSect); 421 424 AssertMsg(!pSession->pUsage, ("Some buster reregistered an object during desturction!\n")); 422 425 } … … 448 451 break; 449 452 450 INTNETIFWAITREQ WaitReq; 451 WaitReq.Hdr.u32Magic = SUPVMMR0REQHDR_MAGIC; 452 WaitReq.Hdr.cbReq = sizeof(WaitReq); 453 WaitReq.pSession = NULL; 454 WaitReq.hIf = pSession->hIfWait; 455 WaitReq.cMillies = 30000; /* 30s - don't wait forever, timeout now and then. */ 456 int rc = IntNetR0IfWaitReq(pSession, &WaitReq); 453 int rc = IntNetR0IfWait(pSession->hIfWait, pSession, 30000); /* 30s - don't wait forever, timeout now and then. */ 457 454 if (RT_SUCCESS(rc)) 458 455 { … … 464 461 && rc != VERR_INTERRUPTED) 465 462 { 466 LogFlow((" drvR3IntNetRecvRun: returns %Rrc\n", rc));463 LogFlow(("intnetR3RecvThread: returns %Rrc\n", rc)); 467 464 return rc; 468 465 } … … 635 632 { 636 633 /* Last one cleans up the global data. */ 637 RTSemFastMutexDestroy(pDevExt->hMtx); 638 pDevExt->hMtx = NIL_RTSEMFASTMUTEX; 634 RTCritSectDelete(&pDevExt->CritSect); 639 635 } 640 636 } … … 680 676 681 677 g_DevExt.pObjs = NULL; 682 rc = RT SemFastMutexCreate(&g_DevExt.hMtx);678 rc = RTCritSectInit(&g_DevExt.CritSect); 683 679 if (RT_SUCCESS(rc)) 684 680 xpc_main(xpcConnHandler); /* Never returns. */
Note:
See TracChangeset
for help on using the changeset viewer.