Changeset 75539 in vbox for trunk/src/VBox/Main/src-client/HGCM.cpp
- Timestamp:
- Nov 17, 2018 2:35:23 AM (7 years ago)
- svn:sync-xref-src-repo-rev:
- 126697
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/src-client/HGCM.cpp
r75500 r75539 90 90 static int sm_cServices; 91 91 92 HGCMT HREADHANDLE m_thread;93 friend DECLCALLBACK(void) hgcmServiceThread(HGCMT HREADHANDLE ThreadHandle, void *pvUser);92 HGCMThread *m_pThread; 93 friend DECLCALLBACK(void) hgcmServiceThread(HGCMThread *pThread, void *pvUser); 94 94 95 95 uint32_t volatile m_u32RefCnt; … … 245 245 HGCMService::HGCMService() 246 246 : 247 m_ thread (0),247 m_pThread (NULL), 248 248 m_u32RefCnt (0), 249 249 m_pSvcNext (NULL), … … 531 531 * The service thread. Loads the service library and calls the service entry points. 532 532 */ 533 DECLCALLBACK(void) hgcmServiceThread(HGCMT HREADHANDLE ThreadHandle, void *pvUser)533 DECLCALLBACK(void) hgcmServiceThread(HGCMThread *pThread, void *pvUser) 534 534 { 535 535 HGCMService *pSvc = (HGCMService *)pvUser; … … 541 541 { 542 542 HGCMMsgCore *pMsgCore; 543 int rc = hgcmMsgGet( ThreadHandle, &pMsgCore);543 int rc = hgcmMsgGet(pThread, &pMsgCore); 544 544 545 545 if (RT_FAILURE(rc)) … … 912 912 RTStrCopy(szThreadName, sizeof(szThreadName), pszServiceName); 913 913 914 int rc = hgcmThreadCreate(&m_ thread, szThreadName, hgcmServiceThread, this, pszServiceName, pUVM);914 int rc = hgcmThreadCreate(&m_pThread, szThreadName, hgcmServiceThread, this, pszServiceName, pUVM); 915 915 916 916 if (RT_SUCCESS(rc)) … … 948 948 /* Execute the load request on the service thread. */ 949 949 HGCMMSGHANDLE hMsg; 950 rc = hgcmMsgAlloc(m_ thread, &hMsg, SVC_MSG_LOAD, hgcmMessageAllocSvc);950 rc = hgcmMsgAlloc(m_pThread, &hMsg, SVC_MSG_LOAD, hgcmMessageAllocSvc); 951 951 952 952 if (RT_SUCCESS(rc)) … … 976 976 977 977 HGCMMSGHANDLE hMsg; 978 int rc = hgcmMsgAlloc(m_ thread, &hMsg, SVC_MSG_UNLOAD, hgcmMessageAllocSvc);978 int rc = hgcmMsgAlloc(m_pThread, &hMsg, SVC_MSG_UNLOAD, hgcmMessageAllocSvc); 979 979 980 980 if (RT_SUCCESS(rc)) … … 983 983 984 984 if (RT_SUCCESS(rc)) 985 { 986 hgcmThreadWait(m_thread); 987 } 985 hgcmThreadWait(m_pThread); 988 986 } 989 987 … … 1004 1002 1005 1003 HGCMMSGHANDLE hMsg; 1006 int rc = hgcmMsgAlloc(m_ thread, &hMsg, SVC_MSG_SAVESTATE, hgcmMessageAllocSvc);1004 int rc = hgcmMsgAlloc(m_pThread, &hMsg, SVC_MSG_SAVESTATE, hgcmMessageAllocSvc); 1007 1005 1008 1006 if (RT_SUCCESS(rc)) … … 1028 1026 1029 1027 HGCMMSGHANDLE hMsg; 1030 int rc = hgcmMsgAlloc(m_ thread, &hMsg, SVC_MSG_LOADSTATE, hgcmMessageAllocSvc);1028 int rc = hgcmMsgAlloc(m_pThread, &hMsg, SVC_MSG_LOADSTATE, hgcmMessageAllocSvc); 1031 1029 1032 1030 if (RT_SUCCESS(rc)) … … 1475 1473 HGCMMSGHANDLE hMsg; 1476 1474 1477 rc = hgcmMsgAlloc(m_ thread, &hMsg, SVC_MSG_CONNECT, hgcmMessageAllocSvc);1475 rc = hgcmMsgAlloc(m_pThread, &hMsg, SVC_MSG_CONNECT, hgcmMessageAllocSvc); 1478 1476 1479 1477 if (RT_SUCCESS(rc)) … … 1560 1558 HGCMMSGHANDLE hMsg; 1561 1559 1562 rc = hgcmMsgAlloc(m_ thread, &hMsg, SVC_MSG_DISCONNECT, hgcmMessageAllocSvc);1560 rc = hgcmMsgAlloc(m_pThread, &hMsg, SVC_MSG_DISCONNECT, hgcmMessageAllocSvc); 1563 1561 1564 1562 if (RT_SUCCESS(rc)) … … 1576 1574 { 1577 1575 LogRel(("(%d, %d) [%s] hgcmMsgAlloc(%p, SVC_MSG_DISCONNECT) failed %Rrc\n", 1578 u32ClientId, fFromService, RT_VALID_PTR(m_pszSvcName)? m_pszSvcName: "", m_ thread, rc));1576 u32ClientId, fFromService, RT_VALID_PTR(m_pszSvcName)? m_pszSvcName: "", m_pThread, rc)); 1579 1577 } 1580 1578 } … … 1590 1588 1591 1589 if (m_cClients > i) 1592 { 1593 memmove (&m_paClientIds[i], &m_paClientIds[i + 1], sizeof(m_paClientIds[0]) * (m_cClients - i)); 1594 } 1590 memmove(&m_paClientIds[i], &m_paClientIds[i + 1], sizeof(m_paClientIds[0]) * (m_cClients - i)); 1595 1591 1596 1592 /* Delete the client handle. */ … … 1616 1612 /* Forward the message to the service thread. */ 1617 1613 HGCMMSGHANDLE hMsg = 0; 1618 int rc = hgcmMsgAlloc(m_ thread, &hMsg, SVC_MSG_REGEXT, hgcmMessageAllocSvc);1614 int rc = hgcmMsgAlloc(m_pThread, &hMsg, SVC_MSG_REGEXT, hgcmMessageAllocSvc); 1619 1615 1620 1616 if (RT_SUCCESS(rc)) … … 1640 1636 /* Forward the message to the service thread. */ 1641 1637 HGCMMSGHANDLE hMsg = 0; 1642 int rc = hgcmMsgAlloc(m_ thread, &hMsg, SVC_MSG_UNREGEXT, hgcmMessageAllocSvc);1638 int rc = hgcmMsgAlloc(m_pThread, &hMsg, SVC_MSG_UNREGEXT, hgcmMessageAllocSvc); 1643 1639 1644 1640 if (RT_SUCCESS(rc)) … … 1675 1671 LogFlow(("MAIN::HGCMService::Call\n")); 1676 1672 1677 int rc = hgcmMsgAlloc(m_ thread, &hMsg, SVC_MSG_GUESTCALL, hgcmMessageAllocSvc);1673 int rc = hgcmMsgAlloc(m_pThread, &hMsg, SVC_MSG_GUESTCALL, hgcmMessageAllocSvc); 1678 1674 1679 1675 if (RT_SUCCESS(rc)) … … 1718 1714 1719 1715 HGCMMSGHANDLE hMsg = 0; 1720 int rc = hgcmMsgAlloc(m_ thread, &hMsg, SVC_MSG_HOSTCALL, hgcmMessageAllocSvc);1716 int rc = hgcmMsgAlloc(m_pThread, &hMsg, SVC_MSG_HOSTCALL, hgcmMessageAllocSvc); 1721 1717 1722 1718 if (RT_SUCCESS(rc)) … … 1775 1771 1776 1772 HGCMMSGHANDLE hMsg = 0; 1777 int rc = hgcmMsgAlloc(m_ thread, &hMsg, SVC_MSG_HOSTFASTCALLASYNC, hgcmMessageAllocSvc);1773 int rc = hgcmMsgAlloc(m_pThread, &hMsg, SVC_MSG_HOSTFASTCALLASYNC, hgcmMessageAllocSvc); 1778 1774 1779 1775 if (RT_SUCCESS(rc)) … … 1939 1935 1940 1936 /* The main HGCM thread handler. */ 1941 static DECLCALLBACK(void) hgcmThread(HGCMTHREADHANDLE ThreadHandle, void *pvUser) 1942 { 1943 LogFlowFunc(("ThreadHandle = %p, pvUser = %p\n", 1944 ThreadHandle, pvUser)); 1937 static DECLCALLBACK(void) hgcmThread(HGCMThread *pThread, void *pvUser) 1938 { 1939 LogFlowFunc(("pThread = %p, pvUser = %p\n", pThread, pvUser)); 1945 1940 1946 1941 NOREF(pvUser); … … 1951 1946 { 1952 1947 HGCMMsgCore *pMsgCore; 1953 int rc = hgcmMsgGet( ThreadHandle, &pMsgCore);1948 int rc = hgcmMsgGet(pThread, &pMsgCore); 1954 1949 1955 1950 if (RT_FAILURE(rc)) … … 2192 2187 */ 2193 2188 2194 /* The main hgcm thread. */2195 static HGCMT HREADHANDLE g_hgcmThread = 0;2189 /** The main hgcm thread. */ 2190 static HGCMThread *g_pHgcmThread = 0; 2196 2191 2197 2192 /* … … 2224 2219 HGCMMSGHANDLE hMsg = 0; 2225 2220 2226 int rc = hgcmMsgAlloc(g_ hgcmThread, &hMsg, HGCM_MSG_LOAD, hgcmMainMessageAlloc);2221 int rc = hgcmMsgAlloc(g_pHgcmThread, &hMsg, HGCM_MSG_LOAD, hgcmMainMessageAlloc); 2227 2222 2228 2223 if (RT_SUCCESS(rc)) … … 2268 2263 HGCMMSGHANDLE hMsg = 0; 2269 2264 2270 int rc = hgcmMsgAlloc(g_ hgcmThread, &hMsg, HGCM_MSG_REGEXT, hgcmMainMessageAlloc);2265 int rc = hgcmMsgAlloc(g_pHgcmThread, &hMsg, HGCM_MSG_REGEXT, hgcmMainMessageAlloc); 2271 2266 2272 2267 if (RT_SUCCESS(rc)) … … 2297 2292 HGCMMSGHANDLE hMsg = 0; 2298 2293 2299 int rc = hgcmMsgAlloc(g_ hgcmThread, &hMsg, HGCM_MSG_UNREGEXT, hgcmMainMessageAlloc);2294 int rc = hgcmMsgAlloc(g_pHgcmThread, &hMsg, HGCM_MSG_UNREGEXT, hgcmMainMessageAlloc); 2300 2295 2301 2296 if (RT_SUCCESS(rc)) … … 2340 2335 HGCMMSGHANDLE hMsg = 0; 2341 2336 2342 int rc = hgcmMsgAlloc(g_ hgcmThread, &hMsg, HGCM_MSG_CONNECT, hgcmMainMessageAlloc);2337 int rc = hgcmMsgAlloc(g_pHgcmThread, &hMsg, HGCM_MSG_CONNECT, hgcmMainMessageAlloc); 2343 2338 2344 2339 if (RT_SUCCESS(rc)) … … 2387 2382 HGCMMSGHANDLE hMsg = 0; 2388 2383 2389 int rc = hgcmMsgAlloc(g_ hgcmThread, &hMsg, HGCM_MSG_DISCONNECT, hgcmMainMessageAlloc);2384 int rc = hgcmMsgAlloc(g_pHgcmThread, &hMsg, HGCM_MSG_DISCONNECT, hgcmMainMessageAlloc); 2390 2385 2391 2386 if (RT_SUCCESS(rc)) … … 2421 2416 HGCMMSGHANDLE hMsg = 0; 2422 2417 2423 int rc = hgcmMsgAlloc(g_ hgcmThread, &hMsg, u32MsgId, hgcmMainMessageAlloc);2418 int rc = hgcmMsgAlloc(g_pHgcmThread, &hMsg, u32MsgId, hgcmMainMessageAlloc); 2424 2419 2425 2420 if (RT_SUCCESS(rc)) … … 2534 2529 * other non-time-critical functions. 2535 2530 */ 2536 int rc = hgcmMsgAlloc(g_ hgcmThread, &hMsg, HGCM_MSG_HOSTCALL, hgcmMainMessageAlloc);2531 int rc = hgcmMsgAlloc(g_pHgcmThread, &hMsg, HGCM_MSG_HOSTCALL, hgcmMainMessageAlloc); 2537 2532 2538 2533 if (RT_SUCCESS(rc)) … … 2578 2573 * other non-time-critical functions. 2579 2574 */ 2580 int rc = hgcmMsgAlloc(g_ hgcmThread, &hMsg, HGCM_MSG_SVCAQUIRE, hgcmMainMessageAlloc);2575 int rc = hgcmMsgAlloc(g_pHgcmThread, &hMsg, HGCM_MSG_SVCAQUIRE, hgcmMainMessageAlloc); 2581 2576 2582 2577 if (RT_SUCCESS(rc)) … … 2619 2614 * other non-time-critical functions. 2620 2615 */ 2621 int rc = hgcmMsgAlloc(g_ hgcmThread, &hMsg, HGCM_MSG_SVCRELEASE, hgcmMainMessageAlloc);2616 int rc = hgcmMsgAlloc(g_pHgcmThread, &hMsg, HGCM_MSG_SVCRELEASE, hgcmMainMessageAlloc); 2622 2617 2623 2618 if (RT_SUCCESS(rc)) … … 2665 2660 HGCMMSGHANDLE hMsg = 0; 2666 2661 2667 int rc = hgcmMsgAlloc(g_ hgcmThread, &hMsg, HGCM_MSG_RESET, hgcmMainMessageAlloc);2662 int rc = hgcmMsgAlloc(g_pHgcmThread, &hMsg, HGCM_MSG_RESET, hgcmMainMessageAlloc); 2668 2663 2669 2664 if (RT_SUCCESS(rc)) … … 2688 2683 */ 2689 2684 2690 rc = hgcmThreadCreate(&g_ hgcmThread, "MainHGCMthread", hgcmThread, NULL /*pvUser*/, NULL /*pszStatsSubDir*/, NULL /*pUVM*/);2685 rc = hgcmThreadCreate(&g_pHgcmThread, "MainHGCMthread", hgcmThread, NULL /*pvUser*/, NULL /*pszStatsSubDir*/, NULL /*pUVM*/); 2691 2686 2692 2687 if (RT_FAILURE(rc)) … … 2715 2710 HGCMMSGHANDLE hMsg = 0; 2716 2711 2717 rc = hgcmMsgAlloc(g_ hgcmThread, &hMsg, HGCM_MSG_QUIT, hgcmMainMessageAlloc);2712 rc = hgcmMsgAlloc(g_pHgcmThread, &hMsg, HGCM_MSG_QUIT, hgcmMainMessageAlloc); 2718 2713 2719 2714 if (RT_SUCCESS(rc)) … … 2724 2719 { 2725 2720 /* Wait for the thread termination. */ 2726 hgcmThreadWait(g_ hgcmThread);2727 g_ hgcmThread = 0;2721 hgcmThreadWait(g_pHgcmThread); 2722 g_pHgcmThread = 0; 2728 2723 2729 2724 hgcmThreadUninit();
Note:
See TracChangeset
for help on using the changeset viewer.