Changeset 28626 in vbox for trunk/src/VBox/Main/GuestImpl.cpp
- Timestamp:
- Apr 23, 2010 8:12:49 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/GuestImpl.cpp
r28625 r28626 979 979 paParms[i++].setUInt32(aPID); 980 980 paParms[i++].setUInt32(aFlags); /** @todo Should represent stdout and/or stderr. */ 981 //paParms[i++].setPointer(outputData.raw(), aSize);982 981 983 982 int vrc = VINF_SUCCESS; 983 984 /* Make sure mParent is valid, so set a read lock in this scope. */ 985 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 984 986 985 987 /* Forward the information to the VMM device. */ … … 992 994 i, paParms); 993 995 } 996 997 alock.release(); 994 998 995 999 if (RT_SUCCESS(vrc)) … … 1003 1007 */ 1004 1008 CallbackListIter it = getCtrlCallbackContextByID(uContextID); 1005 uint64_t u64Started = RTTimeMilliTS(); 1006 do 1007 { 1008 unsigned cMsWait; 1009 if (aTimeoutMS == RT_INDEFINITE_WAIT) 1010 cMsWait = 1000; 1009 if (it != mCallbackList.end()) 1010 { 1011 uint64_t u64Started = RTTimeMilliTS(); 1012 do 1013 { 1014 unsigned cMsWait; 1015 if (aTimeoutMS == RT_INDEFINITE_WAIT) 1016 cMsWait = 1000; 1017 else 1018 { 1019 uint64_t cMsElapsed = RTTimeMilliTS() - u64Started; 1020 if (cMsElapsed >= aTimeoutMS) 1021 break; /* timed out */ 1022 cMsWait = RT_MIN(1000, aTimeoutMS - (uint32_t)cMsElapsed); 1023 } 1024 RTThreadSleep(100); 1025 } while (!it->bCalled); 1026 1027 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 1028 1029 /* Did we get some output? */ 1030 PHOSTEXECOUTCALLBACKDATA pData = (HOSTEXECOUTCALLBACKDATA*)it->pvData; 1031 Assert(it->cbData == sizeof(HOSTEXECOUTCALLBACKDATA)); 1032 AssertPtr(pData); 1033 1034 if ( it->bCalled 1035 && pData->cbData) 1036 { 1037 /* Do we need to resize the array? */ 1038 if (pData->cbData > cbData) 1039 outputData.resize(pData->cbData); 1040 1041 /* Fill output in supplied out buffer. */ 1042 memcpy(outputData.raw(), pData->pvData, pData->cbData); 1043 outputData.resize(pData->cbData); /* Shrink to fit actual buffer size. */ 1044 } 1011 1045 else 1012 { 1013 uint64_t cMsElapsed = RTTimeMilliTS() - u64Started; 1014 if (cMsElapsed >= aTimeoutMS) 1015 break; /* timed out */ 1016 cMsWait = RT_MIN(1000, aTimeoutMS - (uint32_t)cMsElapsed); 1017 } 1018 RTThreadSleep(100); 1019 } while (it != mCallbackList.end() && !it->bCalled); 1020 1021 /* Did we get some output? */ 1022 PHOSTEXECOUTCALLBACKDATA pData = (HOSTEXECOUTCALLBACKDATA*)it->pvData; 1023 Assert(it->cbData == sizeof(HOSTEXECOUTCALLBACKDATA)); 1024 AssertPtr(pData); 1025 1026 if ( it->bCalled 1027 && pData->cbData) 1028 { 1029 /* Do we need to resize the array? */ 1030 if (pData->cbData > cbData) 1031 outputData.resize(pData->cbData); 1032 1033 /* Fill output in supplied out buffer. */ 1034 memcpy(outputData.raw(), pData->pvData, pData->cbData); 1035 outputData.resize(pData->cbData); /* Shrink to fit actual buffer size. */ 1036 } 1037 else 1038 vrc = VERR_NO_DATA; /* This is not an error we want to report to COM. */ 1039 1046 vrc = VERR_NO_DATA; /* This is not an error we want to report to COM. */ 1047 1048 alock.release(); 1049 } 1050 1051 /* If something failed (or there simply was no data, indicated by VERR_NO_DATA, 1052 * we return an empty array so that the frontend knows when to give up. */ 1040 1053 if (RT_FAILURE(vrc) || FAILED(rc)) 1041 1054 outputData.resize(0);
Note:
See TracChangeset
for help on using the changeset viewer.