Changeset 14276 in vbox for trunk/src/VBox
- Timestamp:
- Nov 18, 2008 6:18:54 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/common/VBoxGuest/VBoxGuest.cpp
r14264 r14276 841 841 #ifdef VBOX_WITH_HGCM 842 842 843 # ifndef HGCM_TIMEOUT 843 844 /** 844 845 * This is a callback for dealing with async waits. … … 919 920 } 920 921 921 922 # ifdef HGCM_TIMEOUT 923 /** 924 * This is a callback for dealing with async waits with a timeout. 925 * 926 * It operates in a manner similar to VBoxGuestCommonIOCtl_WaitEvent. 927 * @todo r=bird: merge VBoxGuestHGCMAsyncWaitCallbackTimeout into 928 * VBoxGuestHGCMAsyncWaitCallback, either by using a stack argument or 929 * (better) create a common worker for them 930 */ 931 static DECLCALLBACK(void) 932 VBoxGuestHGCMAsyncWaitCallbackTimeout(VMMDevHGCMRequestHeader *pHdrNonVolatile, void *pvUser, uint32_t u32User) 922 # else /* HGCM_TIMEOUT defined */ 923 /** Worker for VBoxGuestHGCMAsyncWaitCallback* */ 924 void 925 VBoxGuestHGCMAsyncWaitCallbackWorker(VMMDevHGCMRequestHeader *pHdrNonVolatile, PVBOXGUESTDEVEXT pDevExt, 926 bool fInterruptible, uint32_t u32Timeout) 933 927 { 934 928 VMMDevHGCMRequestHeader volatile *pHdr = (VMMDevHGCMRequestHeader volatile *)pHdrNonVolatile; 935 PVBOXGUESTDEVEXT pDevExt = (PVBOXGUESTDEVEXT)pvUser;936 Log(("VBoxGuestHGCMAsyncWaitCallback: requestType=%d\n", pHdr->header.requestType));937 929 938 930 /* … … 978 970 RTSpinlockReleaseNoInts(pDevExt->WaitSpinlock, &Tmp); 979 971 980 int rc = RTSemEventMultiWaitNoResume(pWait->Event, u32User); 972 if (fInterruptible) 973 rc = RTSemEventMultiWaitNoResume(pWait->Event, u32Timeout); 974 else 975 rc = RTSemEventMultiWait(pWait->Event, u32Timeout); 981 976 982 977 /* … … 993 988 VBoxGuestWaitFreeLocked(pDevExt, pWait); 994 989 RTSpinlockReleaseNoInts(pDevExt->WaitSpinlock, &Tmp); 990 } 991 992 /** 993 * This is a callback for dealing with async waits. 994 * 995 * It operates in a manner similar to VBoxGuestCommonIOCtl_WaitEvent. 996 */ 997 static DECLCALLBACK(void) 998 VBoxGuestHGCMAsyncWaitCallback(VMMDevHGCMRequestHeader *pHdrNonVolatile, void *pvUser, uint32_t u32User) 999 { 1000 VMMDevHGCMRequestHeader volatile *pHdr = (VMMDevHGCMRequestHeader volatile *)pHdrNonVolatile; 1001 const bool fInterruptible = (bool)u32User; 1002 PVBOXGUESTDEVEXT pDevExt = (PVBOXGUESTDEVEXT)pvUser; 1003 LogFunc(("requestType=%d\n", pHdr->header.requestType)); 1004 VBoxGuestHGCMAsyncWaitCallbackWorker(pHdrNonVolatile, pDevExt, fInterruptible, RT_INDEFINITE_WAIT); 1005 } 1006 1007 /** 1008 * This is a callback for dealing with async waits with a timeout. 1009 * 1010 * It operates in a manner similar to VBoxGuestCommonIOCtl_WaitEvent. 1011 */ 1012 static DECLCALLBACK(void) 1013 VBoxGuestHGCMAsyncWaitCallbackTimeoutInterruptible(VMMDevHGCMRequestHeader *pHdrNonVolatile, 1014 void *pvUser, uint32_t u32User) 1015 { 1016 PVBOXGUESTDEVEXT pDevExt = (PVBOXGUESTDEVEXT)pvUser; 1017 LogFunc(("requestType=%d\n", pHdr->header.requestType)); 1018 VBoxGuestHGCMAsyncWaitCallbackWorker(pHdrNonVolatile, pDevExt, true, u32user); 1019 } 1020 1021 /** 1022 * This is an uninterruptible callback for dealing with async waits with a timeout. 1023 * 1024 * It operates in a manner similar to VBoxGuestCommonIOCtl_WaitEvent. 1025 */ 1026 static DECLCALLBACK(void) 1027 VBoxGuestHGCMAsyncWaitCallbackTimeout(VMMDevHGCMRequestHeader *pHdrNonVolatile, void *pvUser, 1028 uint32_t u32User) 1029 { 1030 PVBOXGUESTDEVEXT pDevExt = (PVBOXGUESTDEVEXT)pvUser; 1031 LogFunc(("requestType=%d\n", pHdr->header.requestType)); 1032 VBoxGuestHGCMAsyncWaitCallbackWorker(pHdrNonVolatile, pDevExt, false, u32user); 995 1033 } 996 1034 # endif /* HGCM_TIMEOUT */ … … 1205 1243 */ 1206 1244 Log(("VBoxGuestCommonIOCtl: HGCM_CALL: u32Client=%RX32\n", pInfo->u32ClientID)); 1207 int rc = VbglHGCMCall(pInfo, VBoxGuestHGCMAsyncWaitCallbackTimeout, pDevExt, pInfoTimeout->u32Timeout); 1245 int rc; 1246 if (pSession->R0Process == NIL_RTR0PROCESS) 1247 rc = VbglHGCMCall(pInfo, VBoxGuestHGCMAsyncWaitCallbackTimeout, pDevExt, pInfoTimeout->u32Timeout); 1248 else 1249 rc = VbglHGCMCall(pInfo, VBoxGuestHGCMAsyncWaitCallbackTimeoutInterruptible, pDevExt, 1250 pInfoTimeout->u32Timeout); 1208 1251 if (RT_SUCCESS(rc)) 1209 1252 {
Note:
See TracChangeset
for help on using the changeset viewer.