Changeset 91097 in vbox
- Timestamp:
- Sep 2, 2021 2:42:26 PM (3 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
-
include/VBox/hgcmsvc.h (modified) (2 diffs)
-
src/VBox/Main/src-client/HGCM.cpp (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/hgcmsvc.h
r90833 r91097 83 83 * 8.1->9.1 Because pfnDisconnectClient was (temporarily) removed, and 84 84 * acMaxClients and acMaxCallsPerClient added (VBox 6.1.26). 85 * 9.1->10.1 Because pfnDisconnectClient was added back (VBox 6.1.28). 85 86 */ 86 87 #define VBOX_HGCM_SVC_VERSION_MAJOR (0x0009) … … 101 102 void *pvInstance; 102 103 103 #if 0 /* Not thread safe. */ 104 /** The service disconnects the client. */ 105 DECLR3CALLBACKMEMBER(void, pfnDisconnectClient, (void *pvInstance, uint32_t u32ClientID)); 106 #endif 104 /** 105 * The service disconnects the client. 106 * 107 * This can only be used during VBOXHGCMSVCFNTABLE::pfnConnect or 108 * VBOXHGCMSVCFNTABLE::pfnDisconnect and will fail if called out side that 109 * context. 110 * 111 * There will be no VBOXHGCMSVCFNTABLE::pfnDisconnect callback for a client 112 * diconnected in this manner. 113 * 114 * @returns VBox status code. 115 * @retval VERR_NOT_FOUND if the client ID was not found. 116 * @retval VERR_INVALID_CONTEXT if not called during connect or disconnect. 117 * 118 * @remarks Used by external parties, so don't remove just because we don't use 119 * it ourselves. 120 */ 121 DECLR3CALLBACKMEMBER(int, pfnDisconnectClient, (void *pvInstance, uint32_t u32ClientID)); 107 122 108 123 /** -
trunk/src/VBox/Main/src-client/HGCM.cpp
r90267 r91097 109 109 VBOXHGCMSVCFNTABLE m_fntable; 110 110 111 /** Set if servicing SVC_MSG_CONNECT or SVC_MSG_DISCONNECT. 112 * Used for context checking pfnDisconnectClient calls, as it can only 113 * safely be made when the main HGCM thread is waiting on the service to 114 * process those messages. */ 115 bool m_fInConnectOrDisconnect; 116 111 117 uint32_t m_acClients[HGCM_CLIENT_CATEGORY_MAX]; /**< Clients per category. */ 112 118 uint32_t m_cClients; … … 143 149 144 150 static DECLCALLBACK(int) svcHlpCallComplete(VBOXHGCMCALLHANDLE callHandle, int32_t rc); 145 static DECLCALLBACK( void)svcHlpDisconnectClient(void *pvInstance, uint32_t u32ClientId);151 static DECLCALLBACK(int) svcHlpDisconnectClient(void *pvInstance, uint32_t u32ClientId); 146 152 static DECLCALLBACK(bool) svcHlpIsCallRestored(VBOXHGCMCALLHANDLE callHandle); 147 153 static DECLCALLBACK(bool) svcHlpIsCallCancelled(VBOXHGCMCALLHANDLE callHandle); … … 282 288 m_hLdrMod (NIL_RTLDRMOD), 283 289 m_pfnLoad (NULL), 290 m_fInConnectOrDisconnect(false), 284 291 m_cClients (0), 285 292 m_cClientsAllocated (0), … … 672 679 if (pClient) 673 680 { 681 pSvc->m_fInConnectOrDisconnect = true; 674 682 rc = pSvc->m_fntable.pfnConnect(pSvc->m_fntable.pvService, pMsg->u32ClientId, 675 683 HGCM_CLIENT_DATA(pSvc, pClient), 676 684 pMsg->fRequestor, pMsg->fRestoring); 685 pSvc->m_fInConnectOrDisconnect = false; 677 686 678 687 hgcmObjDereference(pClient); … … 692 701 if (pMsg->pClient) 693 702 { 703 pSvc->m_fInConnectOrDisconnect = true; 694 704 rc = pSvc->m_fntable.pfnDisconnect(pSvc->m_fntable.pvService, pMsg->u32ClientId, 695 705 HGCM_CLIENT_DATA(pSvc, pMsg->pClient)); 706 pSvc->m_fInConnectOrDisconnect = false; 696 707 } 697 708 else … … 913 924 } 914 925 915 #if 0 /* not thread safe */916 926 /** 917 927 * @interface_method_impl{VBOXHGCMSVCHELPERS,pfnDisconnectClient} 918 928 */ 919 /* static */ DECLCALLBACK( void) HGCMService::svcHlpDisconnectClient(void *pvInstance, uint32_t u32ClientId)929 /* static */ DECLCALLBACK(int) HGCMService::svcHlpDisconnectClient(void *pvInstance, uint32_t u32ClientId) 920 930 { 921 931 HGCMService *pService = static_cast <HGCMService *> (pvInstance); 922 923 AssertMsgFailed(("This is unused code with a serialization issue.\n" 924 "It touches data which is normally serialized by only running on the HGCM thread!\n")); 925 926 if (pService) 927 { 928 pService->DisconnectClient(u32ClientId, true, NULL); 929 } 930 } 931 #endif 932 AssertReturn(pService, VERR_INVALID_HANDLE); 933 934 /* Only safe to call when the main HGCM thread is waiting on the service 935 to handle a SVC_MSG_CONNECT or SVC_MSG_DISCONNECT message. Otherwise 936 we'd risk racing it and corrupt data structures. */ 937 AssertReturn(pService->m_fInConnectOrDisconnect, VERR_INVALID_CONTEXT); 938 939 return pService->DisconnectClient(u32ClientId, true, NULL); 940 } 932 941 933 942 /** … … 1135 1144 m_svcHelpers.pfnCallComplete = svcHlpCallComplete; 1136 1145 m_svcHelpers.pvInstance = this; 1137 #if 0 /* not thread safe */1138 1146 m_svcHelpers.pfnDisconnectClient = svcHlpDisconnectClient; 1139 #endif1140 1147 m_svcHelpers.pfnIsCallRestored = svcHlpIsCallRestored; 1141 1148 m_svcHelpers.pfnIsCallCancelled = svcHlpIsCallCancelled;
Note:
See TracChangeset
for help on using the changeset viewer.

