- Timestamp:
- Sep 17, 2009 11:12:44 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VBoxManage/VBoxManageGuestProp.cpp
r22914 r23083 168 168 RTPrintf("Name: %lS, value: %lS, flags: %lS\n", name, value, flags); 169 169 ASMAtomicWriteBool(&mSignalled, true); 170 com::EventQueue::getMainEventQueue()->interruptEventQueueProcessing(); 170 171 } 171 172 return S_OK; … … 442 443 443 444 /* 444 * Set up the callback and wait.445 * Set up the callback and loop until signal or timeout. 445 446 * 446 * The waiting is done is 1 sec at the time since there there are races 447 * between the callback and us going to sleep. This also guards against 448 * neglecting XPCOM event queues as well as any select timeout restrictions. 447 * We do this in 1000 ms chunks to be on the safe side (there used to be 448 * better reasons for it). 449 449 */ 450 450 Bstr uuid; … … 460 460 a->virtualBox->RegisterCallback(callback); 461 461 uint64_t u64Started = RTTimeMilliTS(); 462 do { 463 int vrc = com::EventQueue::getMainEventQueue()->processEventQueue(300); 464 if (RT_FAILURE(vrc) && vrc != VERR_TIMEOUT) 465 { 466 RTPrintf("Error waiting for event: %Rrc\n", vrc); 467 return 1; 468 } 469 if (cMsTimeout != RT_INDEFINITE_WAIT && 470 RTTimeMilliTS() - u64Started >= cMsTimeout) 471 break; 472 } while (!cbImpl->Signalled()); 462 do 463 { 464 unsigned cMsWait; 465 if (cMsTimeout == RT_INDEFINITE_WAIT) 466 cMsWait = 1000; 467 else 468 { 469 uint64_t cMsElapsed = RTTimeMilliTS() - u64Started; 470 if (cMsElapsed >= cMsTimeout) 471 break; /* timed out */ 472 cMsWait = RT_MIN(1000, (uint32_t)cMsTimeout - cMsElapsed); 473 } 474 int vrc = com::EventQueue::getMainEventQueue()->processEventQueue(cMsWait); 475 if ( RT_FAILURE(vrc) 476 && vrc != VERR_TIMEOUT) 477 { 478 RTPrintf("Error waiting for event: %Rrc\n", vrc); 479 return 1; 480 } 481 } while (!cbImpl->Signalled()); 473 482 474 483 a->virtualBox->UnregisterCallback(callback);
Note:
See TracChangeset
for help on using the changeset viewer.