Changeset 68102 in vbox
- Timestamp:
- Jul 25, 2017 9:36:25 AM (8 years ago)
- svn:sync-xref-src-repo-rev:
- 117154
- Location:
- trunk/src/VBox/Additions/common/VBoxGuestLib
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/common/VBoxGuestLib/HGCM.cpp
r62521 r68102 40 40 41 41 /** 42 * Initializes the HGCM VBGL bits. 43 * 44 * @return VBox status code. 45 */ 46 int vbglR0HGCMInit(void) 47 { 48 return RTSemFastMutexCreate(&g_vbgldata.mutexHGCMHandle); 49 } 42 * Fast heap for HGCM handles data. 43 * @{ 44 */ 45 46 static RTSEMFASTMUTEX mutexHGCMHandle; 47 48 static struct VBGLHGCMHANDLEDATA aHGCMHandleData[64]; 49 50 /** @} */ 50 51 51 52 /** … … 54 55 * @return VBox status code. 55 56 */ 57 int vbglR0HGCMInit(void) 58 { 59 AssertReturn(mutexHGCMHandle == NIL_RTSEMFASTMUTEX, VINF_ALREADY_INITIALIZED); 60 return RTSemFastMutexCreate(&mutexHGCMHandle); 61 } 62 63 /** 64 * Initializes the HGCM VBGL bits. 65 * 66 * @return VBox status code. 67 */ 56 68 int vbglR0HGCMTerminate(void) 57 69 { 58 RTSemFastMutexDestroy( g_vbgldata.mutexHGCMHandle);59 g_vbgldata.mutexHGCMHandle = NIL_RTSEMFASTMUTEX;70 RTSemFastMutexDestroy(mutexHGCMHandle); 71 mutexHGCMHandle = NIL_RTSEMFASTMUTEX; 60 72 61 73 return VINF_SUCCESS; … … 64 76 DECLINLINE(int) vbglHandleHeapEnter(void) 65 77 { 66 int rc = RTSemFastMutexRequest( g_vbgldata.mutexHGCMHandle);78 int rc = RTSemFastMutexRequest(mutexHGCMHandle); 67 79 68 80 VBGL_HGCM_ASSERT_MSG(RT_SUCCESS(rc), ("Failed to request handle heap mutex, rc = %Rrc\n", rc)); … … 73 85 DECLINLINE(void) vbglHandleHeapLeave(void) 74 86 { 75 RTSemFastMutexRelease( g_vbgldata.mutexHGCMHandle);87 RTSemFastMutexRelease(mutexHGCMHandle); 76 88 } 77 89 … … 86 98 /* Simple linear search in array. This will be called not so often, only connect/disconnect. */ 87 99 /** @todo bitmap for faster search and other obvious optimizations. */ 88 for (i = 0; i < RT_ELEMENTS( g_vbgldata.aHGCMHandleData); i++)100 for (i = 0; i < RT_ELEMENTS(aHGCMHandleData); i++) 89 101 { 90 if (! g_vbgldata.aHGCMHandleData[i].fAllocated)102 if (!aHGCMHandleData[i].fAllocated) 91 103 { 92 p = & g_vbgldata.aHGCMHandleData[i];104 p = &aHGCMHandleData[i]; 93 105 p->fAllocated = 1; 94 106 break; -
trunk/src/VBox/Additions/common/VBoxGuestLib/VBGLInternal.h
r62841 r68102 108 108 109 109 /** @} */ 110 111 /**112 * Fast heap for HGCM handles data.113 * @{114 */115 116 RTSEMFASTMUTEX mutexHGCMHandle;117 118 struct VBGLHGCMHANDLEDATA aHGCMHandleData[64];119 120 /** @} */121 110 #endif 122 111 } VBGLDATA;
Note:
See TracChangeset
for help on using the changeset viewer.