Changeset 42383 in vbox
- Timestamp:
- Jul 25, 2012 10:07:58 AM (12 years ago)
- Location:
- trunk/src/VBox/Main/src-server
- Files:
-
- 2 edited
-
MachineImpl.cpp (modified) (1 diff)
-
VirtualBoxImpl.cpp (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/src-server/MachineImpl.cpp
r42382 r42383 12212 12212 } 12213 12213 12214 /* signal the client watcher thread, because the client is going away */ 12215 mParent->updateClientWatcher(); 12216 12214 12217 LogFlowThisFuncLeave(); 12215 12218 return S_OK; -
trunk/src/VBox/Main/src-server/VirtualBoxImpl.cpp
r42231 r42383 107 107 // static 108 108 Bstr VirtualBox::sAPIVersion; 109 110 #ifdef VBOX_WITH_SYS_V_IPC_SESSION_WATCHER 111 /** Table for adaptive timeouts in the client watcher. The counter starts at 112 * the maximum value and decreases to 0. */ 113 static const RTMSINTERVAL s_updateAdaptTimeouts[] = { 500, 200, 100, 50, 20, 10, 5 }; 114 #endif 109 115 110 116 //////////////////////////////////////////////////////////////////////////////// … … 283 289 // the following are data for the client watcher thread 284 290 const UPDATEREQTYPE updateReq; 291 #ifdef VBOX_WITH_SYS_V_IPC_SESSION_WATCHER 292 uint8_t updateAdaptCtr; 293 #endif 285 294 const RTTHREAD threadClientWatcher; 286 295 typedef std::list<RTPROCESS> ProcessList; … … 516 525 #elif defined(VBOX_WITH_SYS_V_IPC_SESSION_WATCHER) 517 526 RTSemEventCreate(&unconst(m->updateReq)); 527 ASMAtomicUoWriteU8(&m->updateAdaptCtr, 0); 518 528 #else 519 529 # error "Port me!" … … 2627 2637 RTSemEventSignal(m->updateReq); 2628 2638 #elif defined(VBOX_WITH_SYS_V_IPC_SESSION_WATCHER) 2639 ASMAtomicUoWriteU8(&m->updateAdaptCtr, RT_ELEMENTS(s_updateAdaptTimeouts) - 1); 2629 2640 RTSemEventSignal(m->updateReq); 2630 2641 #else … … 4810 4821 autoCaller.release(); 4811 4822 4812 int rc = RTSemEventWait(that->m->updateReq, 500); 4823 /* determine wait timeout adaptively: after updating information 4824 * relevant to the client watcher, check a few times more 4825 * frequently. This ensures good reaction time when the signalling 4826 * has to be done a bit before the actual change for technical 4827 * reasons, and saves CPU cycles when no activities are expected. */ 4828 RTMSINTERVAL cMillies; 4829 { 4830 uint8_t uOld, uNew; 4831 do 4832 { 4833 uOld = ASMAtomicUoReadU8(&that->m->updateAdaptCtr); 4834 uNew = uOld ? uOld - 1 : uOld; 4835 } while (!ASMAtomicCmpXchgU8(&that->m->updateAdaptCtr, uNew, uOld)); 4836 Assert(uOld <= RT_ELEMENTS(s_updateAdaptTimeouts) - 1); 4837 cMillies = s_updateAdaptTimeouts[uOld]; 4838 } 4839 4840 int rc = RTSemEventWait(that->m->updateReq, cMillies); 4813 4841 4814 4842 /*
Note:
See TracChangeset
for help on using the changeset viewer.

