Changeset 8083 in vbox for trunk/src/VBox/Main
- Timestamp:
- Apr 17, 2008 9:12:12 AM (17 years ago)
- Location:
- trunk/src/VBox/Main
- Files:
-
- 48 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/AudioAdapterImpl.cpp
r7992 r8083 92 92 AssertComRCReturnRC (thatCaller.rc()); 93 93 94 AutoRead erLock thatLock (aThat);94 AutoReadLock thatLock (aThat); 95 95 mData.share (aThat->mData); 96 96 … … 124 124 AssertComRCReturnRC (thatCaller.rc()); 125 125 126 AutoRead erLock thatLock (aThat);126 AutoReadLock thatLock (aThat); 127 127 mData.attachCopy (aThat->mData); 128 128 … … 163 163 CheckComRCReturnRC (autoCaller.rc()); 164 164 165 AutoRead erLock alock (this);165 AutoReadLock alock (this); 166 166 167 167 *aEnabled = mData->mEnabled; … … 179 179 CheckComRCReturnRC (adep.rc()); 180 180 181 Auto Lock alock (this);181 AutoWriteLock alock (this); 182 182 183 183 if (mData->mEnabled != aEnabled) … … 198 198 CheckComRCReturnRC (autoCaller.rc()); 199 199 200 AutoRead erLock alock (this);200 AutoReadLock alock (this); 201 201 202 202 *aAudioDriver = mData->mAudioDriver; … … 214 214 CheckComRCReturnRC (adep.rc()); 215 215 216 Auto Lock alock (this);216 AutoWriteLock alock (this); 217 217 218 218 HRESULT rc = S_OK; … … 276 276 CheckComRCReturnRC (autoCaller.rc()); 277 277 278 AutoRead erLock alock (this);278 AutoReadLock alock (this); 279 279 280 280 *aAudioController = mData->mAudioController; … … 292 292 CheckComRCReturnRC (adep.rc()); 293 293 294 Auto Lock alock (this);294 AutoWriteLock alock (this); 295 295 296 296 HRESULT rc = S_OK; … … 344 344 AssertComRCReturnRC (autoCaller.rc()); 345 345 346 Auto Lock alock (this);346 AutoWriteLock alock (this); 347 347 348 348 /* Note: we assume that the default values for attributes of optional … … 438 438 AssertComRCReturnRC (autoCaller.rc()); 439 439 440 AutoRead erLock alock (this);440 AutoReadLock alock (this); 441 441 442 442 Key node = aMachineNode.createKey ("AudioAdapter"); … … 543 543 AssertComRCReturn (autoCaller.rc(), false); 544 544 545 Auto Lock alock (this);545 AutoWriteLock alock (this); 546 546 547 547 bool changed = false; -
trunk/src/VBox/Main/AutoLock.cpp
r8019 r8083 1 1 /** @file 2 2 * 3 * Auto Lock: smart critical section wrapper3 * AutoWriteLock/AutoReadLock: smart R/W semaphore wrappers 4 4 */ 5 5 … … 43 43 } 44 44 45 bool RWLockHandle::is LockedOnCurrentThread() const45 bool RWLockHandle::isWriteLockOnCurrentThread() const 46 46 { 47 47 RTCritSectEnter (&mCritSect); -
trunk/src/VBox/Main/BIOSSettingsImpl.cpp
r7466 r8083 86 86 mPeer = that; 87 87 88 Auto Lock thatlock (that);88 AutoWriteLock thatlock (that); 89 89 mData.share (that->mData); 90 90 … … 114 114 // mPeer is left null 115 115 116 Auto Lock thatlock (that);116 AutoWriteLock thatlock (that); 117 117 mData.attachCopy (that->mData); 118 118 … … 155 155 CheckComRCReturnRC (autoCaller.rc()); 156 156 157 AutoRead erLock alock (this);157 AutoReadLock alock (this); 158 158 159 159 *enabled = mData->mLogoFadeIn; … … 171 171 CheckComRCReturnRC (adep.rc()); 172 172 173 Auto Lock alock (this);173 AutoWriteLock alock (this); 174 174 175 175 mData.backup(); … … 187 187 CheckComRCReturnRC (autoCaller.rc()); 188 188 189 AutoRead erLock alock (this);189 AutoReadLock alock (this); 190 190 191 191 *enabled = mData->mLogoFadeOut; … … 203 203 CheckComRCReturnRC (adep.rc()); 204 204 205 Auto Lock alock (this);205 AutoWriteLock alock (this); 206 206 207 207 mData.backup(); … … 219 219 CheckComRCReturnRC (autoCaller.rc()); 220 220 221 AutoRead erLock alock (this);221 AutoReadLock alock (this); 222 222 223 223 *displayTime = mData->mLogoDisplayTime; … … 235 235 CheckComRCReturnRC (adep.rc()); 236 236 237 Auto Lock alock (this);237 AutoWriteLock alock (this); 238 238 239 239 mData.backup(); … … 251 251 CheckComRCReturnRC (autoCaller.rc()); 252 252 253 AutoRead erLock alock (this);253 AutoReadLock alock (this); 254 254 255 255 mData->mLogoImagePath.cloneTo(imagePath); … … 270 270 CheckComRCReturnRC (adep.rc()); 271 271 272 Auto Lock alock (this);272 AutoWriteLock alock (this); 273 273 274 274 mData.backup(); … … 286 286 CheckComRCReturnRC (autoCaller.rc()); 287 287 288 AutoRead erLock alock (this);288 AutoReadLock alock (this); 289 289 290 290 *bootMenuMode = mData->mBootMenuMode; … … 301 301 CheckComRCReturnRC (adep.rc()); 302 302 303 Auto Lock alock (this);303 AutoWriteLock alock (this); 304 304 305 305 mData.backup(); … … 317 317 CheckComRCReturnRC (autoCaller.rc()); 318 318 319 AutoRead erLock alock (this);319 AutoReadLock alock (this); 320 320 321 321 *enabled = mData->mACPIEnabled; … … 333 333 CheckComRCReturnRC (adep.rc()); 334 334 335 Auto Lock alock (this);335 AutoWriteLock alock (this); 336 336 337 337 mData.backup(); … … 349 349 CheckComRCReturnRC (autoCaller.rc()); 350 350 351 AutoRead erLock alock (this);351 AutoReadLock alock (this); 352 352 353 353 *enabled = mData->mIOAPICEnabled; … … 365 365 CheckComRCReturnRC (adep.rc()); 366 366 367 Auto Lock alock (this);367 AutoWriteLock alock (this); 368 368 369 369 mData.backup(); … … 381 381 CheckComRCReturnRC (autoCaller.rc()); 382 382 383 AutoRead erLock alock (this);383 AutoReadLock alock (this); 384 384 385 385 *enabled = mData->mPXEDebugEnabled; … … 397 397 CheckComRCReturnRC (adep.rc()); 398 398 399 Auto Lock alock (this);399 AutoWriteLock alock (this); 400 400 401 401 mData.backup(); … … 413 413 CheckComRCReturnRC (autoCaller.rc()); 414 414 415 AutoRead erLock alock (this);415 AutoReadLock alock (this); 416 416 417 417 *aControllerType = mData->mIDEControllerType; … … 429 429 CheckComRCReturnRC (adep.rc()); 430 430 431 Auto Lock alock (this);431 AutoWriteLock alock (this); 432 432 433 433 /* make sure the value is allowed */ … … 458 458 CheckComRCReturnRC (autoCaller.rc()); 459 459 460 AutoRead erLock alock (this);460 AutoReadLock alock (this); 461 461 462 462 *offset = mData->mTimeOffset; … … 474 474 CheckComRCReturnRC (adep.rc()); 475 475 476 Auto Lock alock (this);476 AutoWriteLock alock (this); 477 477 478 478 mData.backup(); … … 506 506 AssertComRCReturnRC (autoCaller.rc()); 507 507 508 Auto Lock alock (this);508 AutoWriteLock alock (this); 509 509 510 510 /* Note: we assume that the default values for attributes of optional … … 620 620 AssertComRCReturnRC (autoCaller.rc()); 621 621 622 AutoRead erLock alock (this);622 AutoReadLock alock (this); 623 623 624 624 Key biosNode = aMachineNode.createKey ("BIOS"); … … 705 705 void BIOSSettings::commit() 706 706 { 707 Auto Lock alock (this);707 AutoWriteLock alock (this); 708 708 if (mData.isBackedUp()) 709 709 { … … 712 712 { 713 713 // attach new data to the peer and reshare it 714 Auto Lock peerlock (mPeer);714 AutoWriteLock peerlock (mPeer); 715 715 mPeer->mData.attach (mData); 716 716 } … … 720 720 void BIOSSettings::copyFrom (BIOSSettings *aThat) 721 721 { 722 Auto Lock alock (this);722 AutoWriteLock alock (this); 723 723 724 724 // this will back up current data -
trunk/src/VBox/Main/ConsoleImpl.cpp
r7992 r8083 860 860 AssertComRCReturnVoid (autoCaller.rc()); 861 861 862 AutoRead erLock alock (that);862 AutoReadLock alock (that); 863 863 864 864 int vrc = SSMR3PutU32 (pSSM, (uint32_t)that->mSharedFolders.size()); … … 923 923 AssertComRCReturn (autoCaller.rc(), VERR_ACCESS_DENIED); 924 924 925 Auto Lock alock (that);925 AutoWriteLock alock (that); 926 926 927 927 AssertReturn (that->mSharedFolders.size() == 0, VERR_INTERNAL_ERROR); … … 995 995 CheckComRCReturnRC (autoCaller.rc()); 996 996 997 AutoRead erLock alock (this);997 AutoReadLock alock (this); 998 998 999 999 /* we return our local state (since it's always the same as on the server) */ … … 1068 1068 1069 1069 /* we need a write lock because of the lazy mDebugger initialization*/ 1070 Auto Lock alock (this);1070 AutoWriteLock alock (this); 1071 1071 1072 1072 /* check if we have to create the debugger object */ … … 1090 1090 CheckComRCReturnRC (autoCaller.rc()); 1091 1091 1092 AutoRead erLock alock (this);1092 AutoReadLock alock (this); 1093 1093 1094 1094 ComObjPtr <OUSBDeviceCollection> collection; … … 1108 1108 CheckComRCReturnRC (autoCaller.rc()); 1109 1109 1110 AutoRead erLock alock (this);1110 AutoReadLock alock (this); 1111 1111 1112 1112 ComObjPtr <RemoteUSBDeviceCollection> collection; … … 1142 1142 1143 1143 /* loadDataFromSavedState() needs a write lock */ 1144 Auto Lock alock (this);1144 AutoWriteLock alock (this); 1145 1145 1146 1146 /* Read console data stored in the saved state file (if not yet done) */ … … 1167 1167 CheckComRCReturnRC (autoCaller.rc()); 1168 1168 1169 Auto Lock alock (this);1169 AutoWriteLock alock (this); 1170 1170 1171 1171 if (mMachineState >= MachineState_Running) … … 1400 1400 CheckComRCReturnRC (autoCaller.rc()); 1401 1401 1402 Auto Lock alock (this);1402 AutoWriteLock alock (this); 1403 1403 1404 1404 if (mMachineState != MachineState_Running && … … 1432 1432 CheckComRCReturnRC (autoCaller.rc()); 1433 1433 1434 Auto Lock alock (this);1434 AutoWriteLock alock (this); 1435 1435 1436 1436 if (mMachineState != MachineState_Running) … … 1463 1463 CheckComRCReturnRC (autoCaller.rc()); 1464 1464 1465 Auto Lock alock (this);1465 AutoWriteLock alock (this); 1466 1466 1467 1467 if (mMachineState != MachineState_Running) … … 1497 1497 CheckComRCReturnRC (autoCaller.rc()); 1498 1498 1499 Auto Lock alock (this);1499 AutoWriteLock alock (this); 1500 1500 1501 1501 if (mMachineState != MachineState_Paused) … … 1531 1531 CheckComRCReturnRC (autoCaller.rc()); 1532 1532 1533 Auto Locklock (this);1533 AutoWriteLock alock (this); 1534 1534 1535 1535 if (mMachineState != MachineState_Running) … … 1572 1572 AutoCaller autoCaller (this); 1573 1573 1574 Auto Locklock (this);1574 AutoWriteLock alock (this); 1575 1575 1576 1576 if (mMachineState != MachineState_Running) … … 1611 1611 CheckComRCReturnRC (autoCaller.rc()); 1612 1612 1613 Auto Locklock (this);1613 AutoWriteLock alock (this); 1614 1614 1615 1615 if (mMachineState != MachineState_Running) … … 1652 1652 CheckComRCReturnRC (autoCaller.rc()); 1653 1653 1654 Auto Lock alock (this);1654 AutoWriteLock alock (this); 1655 1655 1656 1656 if (mMachineState != MachineState_Running && … … 1792 1792 CheckComRCReturnRC (autoCaller.rc()); 1793 1793 1794 Auto Lock alock (this);1794 AutoWriteLock alock (this); 1795 1795 1796 1796 if (mMachineState != MachineState_PoweredOff && … … 1809 1809 CheckComRCReturnRC (autoCaller.rc()); 1810 1810 1811 Auto Lock alock (this);1811 AutoWriteLock alock (this); 1812 1812 1813 1813 if (mMachineState != MachineState_Saved) … … 1925 1925 CheckComRCReturnRC (autoCaller.rc()); 1926 1926 1927 Auto Lock alock (this);1927 AutoWriteLock alock (this); 1928 1928 1929 1929 /// @todo (r=dmik) is it legal to attach USB devices when the machine is … … 1986 1986 CheckComRCReturnRC (autoCaller.rc()); 1987 1987 1988 Auto Lock alock (this);1988 AutoWriteLock alock (this); 1989 1989 1990 1990 /* Find it. */ … … 2056 2056 CheckComRCReturnRC (autoCaller.rc()); 2057 2057 2058 Auto Lock alock (this);2058 AutoWriteLock alock (this); 2059 2059 2060 2060 /// @todo see @todo in AttachUSBDevice() about the Paused state … … 2128 2128 CheckComRCReturnRC (autoCaller.rc()); 2129 2129 2130 Auto Lock alock (this);2130 AutoWriteLock alock (this); 2131 2131 2132 2132 /// @todo see @todo in AttachUSBDevice() about the Paused state … … 2193 2193 CheckComRCReturnRC (autoCaller.rc()); 2194 2194 2195 Auto Lock alock (this);2195 AutoWriteLock alock (this); 2196 2196 2197 2197 if (mMachineState > MachineState_Paused) … … 2364 2364 CheckComRCReturnRC (autoCaller.rc()); 2365 2365 2366 Auto Lock alock (this);2366 AutoWriteLock alock (this); 2367 2367 2368 2368 if (mMachineState >= MachineState_Running) … … 2385 2385 CheckComRCReturnRC (autoCaller.rc()); 2386 2386 2387 Auto Lock alock (this);2387 AutoWriteLock alock (this); 2388 2388 2389 2389 if (mMachineState >= MachineState_Running) … … 2406 2406 CheckComRCReturnRC (autoCaller.rc()); 2407 2407 2408 Auto Lock alock (this);2408 AutoWriteLock alock (this); 2409 2409 2410 2410 if (mMachineState >= MachineState_Running) … … 2431 2431 CheckComRCReturnRC (autoCaller.rc()); 2432 2432 2433 Auto Lock alock (this);2433 AutoWriteLock alock (this); 2434 2434 2435 2435 mCallbacks.push_back (CallbackList::value_type (aCallback)); … … 2473 2473 CheckComRCReturnRC (autoCaller.rc()); 2474 2474 2475 Auto Lock alock (this);2475 AutoWriteLock alock (this); 2476 2476 2477 2477 CallbackList::iterator it; … … 2503 2503 2504 2504 /* doDriveChange() needs a write lock */ 2505 Auto Lock alock (this);2505 AutoWriteLock alock (this); 2506 2506 2507 2507 /* Ignore callbacks when there's no VM around */ … … 2600 2600 2601 2601 /* doDriveChange() needs a write lock */ 2602 Auto Lock alock (this);2602 AutoWriteLock alock (this); 2603 2603 2604 2604 /* Ignore callbacks when there's no VM around */ … … 2720 2720 2721 2721 /* We will need to release the write lock before calling EMT */ 2722 Auto Lock alock (this);2722 AutoWriteLock alock (this); 2723 2723 2724 2724 /* protect mpVM */ … … 2812 2812 * meDVDState/meFloppyState members (pointed to by peState). 2813 2813 */ 2814 Auto Lock alock (pThis);2814 AutoWriteLock alock (pThis); 2815 2815 2816 2816 /* protect mpVM */ … … 3101 3101 AssertComRCReturnRC (autoCaller.rc()); 3102 3102 3103 Auto Lock alock (this);3103 AutoWriteLock alock (this); 3104 3104 3105 3105 /* Don't do anything if the VM isn't running */ … … 3187 3187 AssertComRCReturnRC (autoCaller.rc()); 3188 3188 3189 Auto Lock alock (this);3189 AutoWriteLock alock (this); 3190 3190 3191 3191 /* Don't do anything if the VM isn't running */ … … 3225 3225 AssertComRCReturnRC (autoCaller.rc()); 3226 3226 3227 Auto Lock alock (this);3227 AutoWriteLock alock (this); 3228 3228 3229 3229 /* Don't do anything if the VM isn't running */ … … 3261 3261 AssertComRCReturnRC (autoCaller.rc()); 3262 3262 3263 Auto Lock alock (this);3263 AutoWriteLock alock (this); 3264 3264 3265 3265 HRESULT rc = S_OK; … … 3317 3317 AssertComRCReturnRC (autoCaller.rc()); 3318 3318 3319 Auto Lock alock (this);3319 AutoWriteLock alock (this); 3320 3320 3321 3321 /* Ignore if no VM is running yet. */ … … 3359 3359 AssertComRCReturnRC (autoCaller.rc()); 3360 3360 3361 Auto Lock alock (this);3361 AutoWriteLock alock (this); 3362 3362 3363 3363 HRESULT rc = fetchSharedFolders (aGlobal); … … 3398 3398 ComAssertComRCRetRC (autoCaller.rc()); 3399 3399 3400 Auto Lock alock (this);3400 AutoWriteLock alock (this); 3401 3401 3402 3402 /* protect mpVM (we don't need error info, since it's a callback) */ … … 3464 3464 AssertComRCReturnRC (autoCaller.rc()); 3465 3465 3466 Auto Lock alock (this);3466 AutoWriteLock alock (this); 3467 3467 3468 3468 /* Find the device. */ … … 3545 3545 AssertComRCReturnRC (autoCaller.rc()); 3546 3546 3547 Auto Lock alock (this);3547 AutoWriteLock alock (this); 3548 3548 3549 3549 AssertReturn (mMachineState == MachineState_Saving || … … 3573 3573 3574 3574 /* We need a write lock because we alter the cached callback data */ 3575 Auto Lock alock (this);3575 AutoWriteLock alock (this); 3576 3576 3577 3577 /* Save the callback arguments */ … … 3640 3640 3641 3641 /* We need a write lock because we alter the cached callback data */ 3642 Auto Lock alock (this);3642 AutoWriteLock alock (this); 3643 3643 3644 3644 /* save the callback arguments */ … … 3663 3663 AssertComRCReturnVoid (autoCaller.rc()); 3664 3664 3665 AutoRead erLock alock (this);3665 AutoReadLock alock (this); 3666 3666 3667 3667 CallbackList::iterator it = mCallbacks.begin(); … … 3678 3678 AssertComRCReturnVoid (autoCaller.rc()); 3679 3679 3680 AutoRead erLock alock (this);3680 AutoReadLock alock (this); 3681 3681 3682 3682 CallbackList::iterator it = mCallbacks.begin(); … … 3693 3693 AssertComRCReturnVoid (autoCaller.rc()); 3694 3694 3695 AutoRead erLock alock (this);3695 AutoReadLock alock (this); 3696 3696 3697 3697 /** @todo Use the On-Screen Display feature to report the fact. … … 3711 3711 3712 3712 /* We need a write lock because we alter the cached callback data */ 3713 Auto Lock alock (this);3713 AutoWriteLock alock (this); 3714 3714 3715 3715 /* save the callback arguments */ … … 3733 3733 AssertComRCReturnVoid (autoCaller.rc()); 3734 3734 3735 AutoRead erLock alock (this);3735 AutoReadLock alock (this); 3736 3736 3737 3737 CallbackList::iterator it = mCallbacks.begin(); … … 3748 3748 AssertComRCReturnVoid (autoCaller.rc()); 3749 3749 3750 AutoRead erLock alock (this);3750 AutoReadLock alock (this); 3751 3751 3752 3752 CallbackList::iterator it = mCallbacks.begin(); … … 3769 3769 AssertComRCReturnRC (autoCaller.rc()); 3770 3770 3771 AutoRead erLock alock (this);3771 AutoReadLock alock (this); 3772 3772 3773 3773 HRESULT rc = S_OK; … … 3837 3837 AssertComRCReturnRC (autoCaller.rc()); 3838 3838 3839 Auto Lock alock (this);3839 AutoWriteLock alock (this); 3840 3840 3841 3841 if (mVMDestroying) … … 3871 3871 AssertComRCReturnVoid (autoCaller.rc()); 3872 3872 3873 Auto Lock alock (this);3873 AutoWriteLock alock (this); 3874 3874 3875 3875 AssertReturnVoid (mpVM != NULL); … … 4014 4014 AssertComRCReturnRC (autoCaller.rc()); 4015 4015 4016 Auto Lock alock (this);4016 AutoWriteLock alock (this); 4017 4017 4018 4018 /* sanity */ … … 4235 4235 AssertComRCReturnRC (autoCaller.rc()); 4236 4236 4237 Auto Lock alock (this);4237 AutoWriteLock alock (this); 4238 4238 4239 4239 HRESULT rc = S_OK; … … 4297 4297 { 4298 4298 /* sanity check */ 4299 AssertReturn (is LockedOnCurrentThread(), E_FAIL);4299 AssertReturn (isWriteLockOnCurrentThread(), E_FAIL); 4300 4300 4301 4301 SharedFolderMap::const_iterator it = mSharedFolders.find (aName); … … 4324 4324 /* sanity check */ 4325 4325 AssertReturn (AutoCaller (this).state() == InInit || 4326 is LockedOnCurrentThread(), E_FAIL);4326 isWriteLockOnCurrentThread(), E_FAIL); 4327 4327 4328 4328 /* protect mpVM (if not NULL) */ … … 4447 4447 { 4448 4448 /* sanity check */ 4449 AssertReturn (is LockedOnCurrentThread(), false);4449 AssertReturn (isWriteLockOnCurrentThread(), false); 4450 4450 4451 4451 /* first, search machine folders */ … … 4626 4626 case VMSTATE_OFF: 4627 4627 { 4628 Auto Lock alock (that);4628 AutoWriteLock alock (that); 4629 4629 4630 4630 if (that->mVMStateChangeCallbackDisabled) … … 4690 4690 case VMSTATE_TERMINATED: 4691 4691 { 4692 Auto Lock alock (that);4692 AutoWriteLock alock (that); 4693 4693 4694 4694 if (that->mVMStateChangeCallbackDisabled) … … 4749 4749 if (aOldState == VMSTATE_RUNNING) 4750 4750 { 4751 Auto Lock alock (that);4751 AutoWriteLock alock (that); 4752 4752 4753 4753 if (that->mVMStateChangeCallbackDisabled) … … 4767 4767 aOldState == VMSTATE_SUSPENDED) 4768 4768 { 4769 Auto Lock alock (that);4769 AutoWriteLock alock (that); 4770 4770 4771 4771 if (that->mVMStateChangeCallbackDisabled) … … 4790 4790 case VMSTATE_GURU_MEDITATION: 4791 4791 { 4792 Auto Lock alock (that);4792 AutoWriteLock alock (that); 4793 4793 4794 4794 if (that->mVMStateChangeCallbackDisabled) … … 4823 4823 { 4824 4824 AssertReturn (aHostDevice, E_FAIL); 4825 AssertReturn (is LockedOnCurrentThread(), E_FAIL);4825 AssertReturn (isWriteLockOnCurrentThread(), E_FAIL); 4826 4826 4827 4827 /* still want a lock object because we need to leave it */ 4828 Auto Lock alock (this);4828 AutoWriteLock alock (this); 4829 4829 4830 4830 HRESULT hrc; … … 4940 4940 AssertComRC (hrc); 4941 4941 4942 Auto Lock alock (that);4942 AutoWriteLock alock (that); 4943 4943 that->mUSBDevices.push_back (device); 4944 4944 LogFlowFunc (("Attached device {%Vuuid}\n", device->id().raw())); … … 4965 4965 HRESULT Console::detachUSBDevice (USBDeviceList::iterator &aIt) 4966 4966 { 4967 AssertReturn (is LockedOnCurrentThread(), E_FAIL);4967 AssertReturn (isWriteLockOnCurrentThread(), E_FAIL); 4968 4968 4969 4969 /* still want a lock object because we need to leave it */ 4970 Auto Lock alock (this);4970 AutoWriteLock alock (this); 4971 4971 4972 4972 /* protect mpVM */ … … 5034 5034 if (VBOX_SUCCESS (vrc)) 5035 5035 { 5036 Auto Lock alock (that);5036 AutoWriteLock alock (that); 5037 5037 5038 5038 /* Remove the device from the collection */ … … 5152 5152 LogFlowThisFunc(("\n")); 5153 5153 /* sanity check */ 5154 AssertReturn (is LockedOnCurrentThread(), E_FAIL);5154 AssertReturn (isWriteLockOnCurrentThread(), E_FAIL); 5155 5155 5156 5156 #ifdef DEBUG … … 5350 5350 /* sanity check */ 5351 5351 LogFlowThisFunc(("\n")); 5352 AssertReturn (is LockedOnCurrentThread(), E_FAIL);5352 AssertReturn (isWriteLockOnCurrentThread(), E_FAIL); 5353 5353 5354 5354 HRESULT rc = S_OK; … … 5448 5448 5449 5449 /* sanity check */ 5450 AssertReturn (is LockedOnCurrentThread(), E_FAIL);5450 AssertReturn (isWriteLockOnCurrentThread(), E_FAIL); 5451 5451 5452 5452 /* … … 5584 5584 5585 5585 /* sanity check */ 5586 ComAssertRet (is LockedOnCurrentThread(), E_FAIL);5586 ComAssertRet (isWriteLockOnCurrentThread(), E_FAIL); 5587 5587 5588 5588 /* If the machine has an USB controller, ask the USB proxy service to … … 5595 5595 * us back from under its lock (e.g. onUSBDeviceAttach()) which would 5596 5596 * produce an inter-process dead-lock otherwise. */ 5597 Auto Lock alock (this);5597 AutoWriteLock alock (this); 5598 5598 alock.leave(); 5599 5599 … … 5622 5622 5623 5623 /* sanity check */ 5624 AssertReturnVoid (is LockedOnCurrentThread());5624 AssertReturnVoid (isWriteLockOnCurrentThread()); 5625 5625 5626 5626 mUSBDevices.clear(); … … 5629 5629 * us back from under its lock (e.g. onUSBDeviceAttach()) which would 5630 5630 * produce an inter-process dead-lock otherwise. */ 5631 Auto Lock alock (this);5631 AutoWriteLock alock (this); 5632 5632 alock.leave(); 5633 5633 … … 5654 5654 } 5655 5655 5656 Auto Lock alock (this);5656 AutoWriteLock alock (this); 5657 5657 5658 5658 /* … … 5845 5845 /* Note: no need to use addCaller() because VMPowerUpTask does that */ 5846 5846 5847 Auto Lock alock (console);5847 AutoWriteLock alock (console); 5848 5848 5849 5849 /* sanity */ … … 6385 6385 6386 6386 /* lock the console sonce we're going to access it */ 6387 Auto Lock thatLock (that);6387 AutoWriteLock thatLock (that); 6388 6388 6389 6389 if (SUCCEEDED (rc)) -
trunk/src/VBox/Main/ConsoleImpl2.cpp
r7990 r8083 88 88 89 89 /* lock the console because we widely use internal fields and methods */ 90 Auto Lock alock (pConsole);90 AutoWriteLock alock (pConsole); 91 91 92 92 ComPtr <IMachine> pMachine = pConsole->machine(); -
trunk/src/VBox/Main/ConsoleVRDPServer.cpp
r7761 r8083 633 633 com::Bstr bstr; 634 634 server->mConsole->getVRDPServer ()->COMGETTER(NetAddress) (bstr.asOutParam()); 635 635 636 636 /* The server expects UTF8. */ 637 637 com::Utf8Str address = bstr; 638 638 639 639 size_t cbAddress = address.length () + 1; 640 640 641 641 if (cbAddress >= 0x10000) 642 642 { … … 645 645 break; 646 646 } 647 647 648 648 if ((size_t)cbBuffer >= cbAddress) 649 649 { … … 974 974 server->m_InputSynch.fClientScrollLock = (pInputSynch->uLockStatus & VRDP_INPUT_SYNCH_SCROLL) != 0; 975 975 976 /* The client initiated synchronization. Always make the guest to reflect the client state. 976 /* The client initiated synchronization. Always make the guest to reflect the client state. 977 977 * Than means, when the guest changes the state itself, it is forced to return to the client 978 978 * state. … … 1037 1037 m_InputSynch.fGuestCapsLock = false; 1038 1038 m_InputSynch.fGuestScrollLock = false; 1039 1039 1040 1040 m_InputSynch.fClientNumLock = false; 1041 1041 m_InputSynch.fClientCapsLock = false; 1042 1042 m_InputSynch.fClientScrollLock = false; 1043 1043 1044 1044 memset (maFramebuffers, 0, sizeof (maFramebuffers)); 1045 1045 … … 2018 2018 ComAssertRet (aParent, E_INVALIDARG); 2019 2019 2020 Auto Lock alock (this);2020 AutoWriteLock alock (this); 2021 2021 ComAssertRet (!isReady(), E_UNEXPECTED); 2022 2022 … … 2035 2035 LogFlowMember (("RemoteDisplayInfo::uninit()\n")); 2036 2036 2037 Auto Lock alock (this);2037 AutoWriteLock alock (this); 2038 2038 AssertReturn (isReady(), (void) 0); 2039 2039 … … 2052 2052 return E_POINTER; \ 2053 2053 \ 2054 Auto Lock alock (this); \2054 AutoWriteLock alock (this); \ 2055 2055 CHECK_READY(); \ 2056 2056 \ … … 2072 2072 return E_POINTER; \ 2073 2073 \ 2074 Auto Lock alock (this); \2074 AutoWriteLock alock (this); \ 2075 2075 CHECK_READY(); \ 2076 2076 \ … … 2092 2092 return E_POINTER; \ 2093 2093 \ 2094 Auto Lock alock (this); \2094 AutoWriteLock alock (this); \ 2095 2095 CHECK_READY(); \ 2096 2096 \ -
trunk/src/VBox/Main/DVDDriveImpl.cpp
r7992 r8083 97 97 AssertComRCReturnRC (thatCaller.rc()); 98 98 99 AutoRead erLock thatLock (aThat);99 AutoReadLock thatLock (aThat); 100 100 mData.share (aThat->mData); 101 101 … … 129 129 AssertComRCReturnRC (thatCaller.rc()); 130 130 131 AutoRead erLock thatLock (aThat);131 AutoReadLock thatLock (aThat); 132 132 mData.attachCopy (aThat->mData); 133 133 … … 168 168 CheckComRCReturnRC (autoCaller.rc()); 169 169 170 AutoRead erLock alock (this);170 AutoReadLock alock (this); 171 171 172 172 *aDriveState = mData->mDriveState; … … 183 183 CheckComRCReturnRC (autoCaller.rc()); 184 184 185 AutoRead erLock alock (this);185 AutoReadLock alock (this); 186 186 187 187 *aPassthrough = mData->mPassthrough; … … 199 199 CheckComRCReturnRC (adep.rc()); 200 200 201 Auto Lock alock (this);201 AutoWriteLock alock (this); 202 202 203 203 if (mData->mPassthrough != aPassthrough) … … 225 225 CheckComRCReturnRC (adep.rc()); 226 226 227 Auto Lock alock (this);227 AutoWriteLock alock (this); 228 228 229 229 HRESULT rc = E_FAIL; … … 269 269 CheckComRCReturnRC (adep.rc()); 270 270 271 Auto Lock alock (this);271 AutoWriteLock alock (this); 272 272 273 273 if (mData->mDriveState != DriveState_HostDriveCaptured || … … 299 299 CheckComRCReturnRC (adep.rc()); 300 300 301 Auto Lock alock (this);301 AutoWriteLock alock (this); 302 302 303 303 if (mData->mDriveState != DriveState_NotMounted) … … 326 326 CheckComRCReturnRC (autoCaller.rc()); 327 327 328 AutoRead erLock alock (this);328 AutoReadLock alock (this); 329 329 330 330 mData->mDVDImage.queryInterfaceTo (aDVDImage); … … 341 341 CheckComRCReturnRC (autoCaller.rc()); 342 342 343 AutoRead erLock alock (this);343 AutoReadLock alock (this); 344 344 345 345 mData->mHostDrive.queryInterfaceTo (aHostDrive); … … 368 368 AssertComRCReturnRC (autoCaller.rc()); 369 369 370 Auto Lock alock (this);370 AutoWriteLock alock (this); 371 371 372 372 /* Note: we assume that the default values for attributes of optional … … 451 451 AssertComRCReturnRC (autoCaller.rc()); 452 452 453 AutoRead erLock alock (this);453 AutoReadLock alock (this); 454 454 455 455 Key node = aMachineNode.createKey ("DVDDrive"); … … 506 506 AssertComRCReturn (autoCaller.rc(), false); 507 507 508 Auto Lock alock (this);508 AutoWriteLock alock (this); 509 509 510 510 bool changed = false; … … 585 585 HRESULT DVDDrive::unmount() 586 586 { 587 AssertReturn (is LockedOnCurrentThread(), E_FAIL);587 AssertReturn (isWriteLockOnCurrentThread(), E_FAIL); 588 588 589 589 if (mData->mDVDImage) -
trunk/src/VBox/Main/DVDImageImpl.cpp
r5999 r8083 168 168 CheckComRCReturnRC (autoCaller.rc()); 169 169 170 AutoRead erLock alock (this);170 AutoReadLock alock (this); 171 171 172 172 mImageFileFull.cloneTo (aFilePath); … … 183 183 CheckComRCReturnRC (autoCaller.rc()); 184 184 185 Auto Lock alock (this);185 AutoWriteLock alock (this); 186 186 187 187 HRESULT rc = S_OK; … … 218 218 CheckComRCReturnRC (autoCaller.rc()); 219 219 220 AutoRead erLock alock (this);220 AutoReadLock alock (this); 221 221 222 222 RTFILE file; … … 270 270 AssertComRCReturnVoid (autoCaller.rc()); 271 271 272 Auto Lock alock (this);272 AutoWriteLock alock (this); 273 273 274 274 unconst (mImageFileFull) = aNewFullPath; -
trunk/src/VBox/Main/DisplayImpl.cpp
r7258 r8083 112 112 ComAssertRet (parent, E_INVALIDARG); 113 113 114 Auto Lock alock (this);114 AutoWriteLock alock (this); 115 115 ComAssertRet (!isReady(), E_UNEXPECTED); 116 116 … … 167 167 LogFlowFunc (("isReady=%d\n", isReady())); 168 168 169 Auto Lock alock (this);169 AutoWriteLock alock (this); 170 170 AssertReturn (isReady(), (void) 0); 171 171 … … 1246 1246 return E_POINTER; 1247 1247 1248 Auto Lock alock (this);1248 AutoWriteLock alock (this); 1249 1249 CHECK_READY(); 1250 1250 … … 1266 1266 return E_POINTER; 1267 1267 1268 Auto Lock alock (this);1268 AutoWriteLock alock (this); 1269 1269 CHECK_READY(); 1270 1270 … … 1286 1286 return E_INVALIDARG; 1287 1287 1288 Auto Lock alock (this);1288 AutoWriteLock alock (this); 1289 1289 CHECK_READY(); 1290 1290 … … 1306 1306 LogFlowFunc (("\n")); 1307 1307 1308 Auto Locklock (this);1308 AutoWriteLock alock (this); 1309 1309 CHECK_READY(); 1310 1310 … … 1326 1326 { 1327 1327 /* Must leave the lock here because the changeFramebuffer will also obtain it. */ 1328 lock.leave ();1328 alock.leave (); 1329 1329 1330 1330 /* send request to the EMT thread */ … … 1338 1338 VMR3ReqFree (pReq); 1339 1339 1340 lock.enter ();1340 alock.enter (); 1341 1341 1342 1342 ComAssertRCRet (vrc, E_FAIL); … … 1357 1357 return E_POINTER; 1358 1358 1359 Auto Lock lock(this);1359 AutoWriteLock alock (this); 1360 1360 CHECK_READY(); 1361 1361 … … 1377 1377 STDMETHODIMP Display::UnlockFramebuffer() 1378 1378 { 1379 Auto Lock lock(this);1379 AutoWriteLock alock (this); 1380 1380 CHECK_READY(); 1381 1381 … … 1400 1400 return E_POINTER; 1401 1401 1402 Auto Locklock (this);1402 AutoWriteLock alock (this); 1403 1403 CHECK_READY(); 1404 1404 … … 1407 1407 { 1408 1408 /* Must leave the lock here because the changeFramebuffer will also obtain it. */ 1409 lock.leave ();1409 alock.leave (); 1410 1410 1411 1411 /* send request to the EMT thread */ … … 1418 1418 VMR3ReqFree (pReq); 1419 1419 1420 lock.enter ();1420 alock.enter (); 1421 1421 1422 1422 ComAssertRCRet (vrc, E_FAIL); … … 1439 1439 return E_POINTER; 1440 1440 1441 Auto Locklock (this);1441 AutoWriteLock alock (this); 1442 1442 CHECK_READY(); 1443 1443 … … 1446 1446 { 1447 1447 /* Must leave the lock here because the changeFramebuffer will also obtain it. */ 1448 lock.leave ();1448 alock.leave (); 1449 1449 1450 1450 /* send request to the EMT thread */ … … 1457 1457 VMR3ReqFree (pReq); 1458 1458 1459 lock.enter ();1459 alock.enter (); 1460 1460 1461 1461 ComAssertRCRet (vrc, E_FAIL); … … 1478 1478 return E_POINTER; 1479 1479 1480 Auto Locklock (this);1480 AutoWriteLock alock (this); 1481 1481 CHECK_READY(); 1482 1482 … … 1497 1497 STDMETHODIMP Display::SetVideoModeHint(ULONG aWidth, ULONG aHeight, ULONG aBitsPerPixel, ULONG aDisplay) 1498 1498 { 1499 Auto Lock lock(this);1499 AutoWriteLock alock (this); 1500 1500 CHECK_READY(); 1501 1501 … … 1534 1534 1535 1535 /* Have to leave the lock because the pfnRequestDisplayChange will call EMT. */ 1536 lock.leave ();1536 alock.leave (); 1537 1537 if (mParent->getVMMDev()) 1538 1538 mParent->getVMMDev()->getVMMDevPort()-> … … 1544 1544 STDMETHODIMP Display::SetSeamlessMode (BOOL enabled) 1545 1545 { 1546 Auto Lock lock(this);1546 AutoWriteLock alock (this); 1547 1547 CHECK_READY(); 1548 1548 1549 1549 /* Have to leave the lock because the pfnRequestSeamlessChange will call EMT. */ 1550 lock.leave ();1550 alock.leave (); 1551 1551 if (mParent->getVMMDev()) 1552 1552 mParent->getVMMDev()->getVMMDevPort()-> … … 1573 1573 return E_INVALIDARG; 1574 1574 1575 Auto Lock lock(this);1575 AutoWriteLock alock (this); 1576 1576 CHECK_READY(); 1577 1577 … … 1643 1643 return E_INVALIDARG; 1644 1644 1645 Auto Lock lock(this);1645 AutoWriteLock alock (this); 1646 1646 CHECK_READY(); 1647 1647 … … 1700 1700 LogFlowFuncEnter(); 1701 1701 1702 Auto Lock lock(this);1702 AutoWriteLock alock (this); 1703 1703 CHECK_READY(); 1704 1704 … … 1738 1738 LogFlowFunc (("\n")); 1739 1739 1740 /// @todo (dmik) can we Auto Lock alock (this); here?1740 /// @todo (dmik) can we AutoWriteLock alock (this); here? 1741 1741 // do it when we switch this class to VirtualBoxBase_NEXT. 1742 1742 // This will require general code review and may add some details. … … 1771 1771 LogFlowFunc (("\n")); 1772 1772 1773 /// @todo (dmik) can we Auto Lock alock (this); here?1773 /// @todo (dmik) can we AutoWriteLock alock (this); here? 1774 1774 // do it when we switch this class to VirtualBoxBase_NEXT. 1775 1775 // Tthis will require general code review and may add some details. … … 1905 1905 /// @todo (r=dmik) AutoCaller 1906 1906 1907 Auto Lock alock (that);1907 AutoWriteLock alock (that); 1908 1908 1909 1909 DISPLAYFBINFO *pDisplayFBInfo = &that->maFramebuffers[uScreenId]; … … 2388 2388 if (pData->pDisplay) 2389 2389 { 2390 Auto Lock displayLock (pData->pDisplay);2390 AutoWriteLock displayLock (pData->pDisplay); 2391 2391 pData->pDisplay->mpDrv = NULL; 2392 2392 pData->pDisplay->mpVMMDev = NULL; -
trunk/src/VBox/Main/FloppyDriveImpl.cpp
r7992 r8083 97 97 AssertComRCReturnRC (thatCaller.rc()); 98 98 99 AutoRead erLock thatLock (aThat);99 AutoReadLock thatLock (aThat); 100 100 mData.share (aThat->mData); 101 101 … … 129 129 AssertComRCReturnRC (thatCaller.rc()); 130 130 131 AutoRead erLock thatLock (aThat);131 AutoReadLock thatLock (aThat); 132 132 mData.attachCopy (aThat->mData); 133 133 … … 168 168 CheckComRCReturnRC (autoCaller.rc()); 169 169 170 AutoRead erLock alock (this);170 AutoReadLock alock (this); 171 171 172 172 *aEnabled = mData->mEnabled; … … 186 186 CheckComRCReturnRC (adep.rc()); 187 187 188 Auto Lock alock (this);188 AutoWriteLock alock (this); 189 189 190 190 if (mData->mEnabled != aEnabled) … … 210 210 CheckComRCReturnRC (autoCaller.rc()); 211 211 212 AutoRead erLock alock (this);212 AutoReadLock alock (this); 213 213 214 214 *aDriveState = mData->mDriveState; … … 232 232 CheckComRCReturnRC (adep.rc()); 233 233 234 Auto Lock alock (this);234 AutoWriteLock alock (this); 235 235 236 236 HRESULT rc = E_FAIL; … … 276 276 CheckComRCReturnRC (adep.rc()); 277 277 278 Auto Lock alock (this);278 AutoWriteLock alock (this); 279 279 280 280 if (mData->mDriveState != DriveState_HostDriveCaptured || … … 306 306 CheckComRCReturnRC (adep.rc()); 307 307 308 Auto Lock alock (this);308 AutoWriteLock alock (this); 309 309 310 310 if (mData->mDriveState != DriveState_NotMounted) … … 333 333 CheckComRCReturnRC (autoCaller.rc()); 334 334 335 AutoRead erLock alock (this);335 AutoReadLock alock (this); 336 336 337 337 mData->mFloppyImage.queryInterfaceTo (aFloppyImage); … … 348 348 CheckComRCReturnRC (autoCaller.rc()); 349 349 350 AutoRead erLock alock (this);350 AutoReadLock alock (this); 351 351 352 352 mData->mHostDrive.queryInterfaceTo (aHostDrive); … … 375 375 AssertComRCReturnRC (autoCaller.rc()); 376 376 377 Auto Lock alock (this);377 AutoWriteLock alock (this); 378 378 379 379 /* Note: we assume that the default values for attributes of optional … … 458 458 AssertComRCReturnRC (autoCaller.rc()); 459 459 460 AutoRead erLock alock (this);460 AutoReadLock alock (this); 461 461 462 462 Key node = aMachineNode.createKey ("FloppyDrive"); … … 513 513 AssertComRCReturn (autoCaller.rc(), false); 514 514 515 Auto Lock alock (this);515 AutoWriteLock alock (this); 516 516 517 517 bool changed = false; … … 589 589 HRESULT FloppyDrive::unmount() 590 590 { 591 AssertReturn (is LockedOnCurrentThread(), E_FAIL);591 AssertReturn (isWriteLockOnCurrentThread(), E_FAIL); 592 592 593 593 if (mData->mFloppyImage) -
trunk/src/VBox/Main/FloppyImageImpl.cpp
r5999 r8083 164 164 CheckComRCReturnRC (autoCaller.rc()); 165 165 166 AutoRead erLock alock (this);166 AutoReadLock alock (this); 167 167 168 168 mImageFileFull.cloneTo (aFilePath); … … 179 179 CheckComRCReturnRC (autoCaller.rc()); 180 180 181 Auto Lock alock (this);181 AutoWriteLock alock (this); 182 182 183 183 HRESULT rc = S_OK; … … 214 214 CheckComRCReturnRC (autoCaller.rc()); 215 215 216 AutoRead erLock alock (this);216 AutoReadLock alock (this); 217 217 218 218 RTFILE file; … … 265 265 AssertComRCReturnVoid (autoCaller.rc()); 266 266 267 Auto Lock alock (this);267 AutoWriteLock alock (this); 268 268 269 269 unconst (mImageFileFull) = aNewFullPath; -
trunk/src/VBox/Main/GuestImpl.cpp
r7409 r8083 116 116 CheckComRCReturnRC (autoCaller.rc()); 117 117 118 AutoRead erLock alock (this);118 AutoReadLock alock (this); 119 119 120 120 // redirect the call to IMachine if no additions are installed … … 135 135 CheckComRCReturnRC (autoCaller.rc()); 136 136 137 AutoRead erLock alock (this);137 AutoReadLock alock (this); 138 138 139 139 *aAdditionsActive = mData.mAdditionsActive; … … 150 150 CheckComRCReturnRC (autoCaller.rc()); 151 151 152 AutoRead erLock alock (this);152 AutoReadLock alock (this); 153 153 154 154 mData.mAdditionsVersion.cloneTo (aAdditionsVersion); … … 165 165 CheckComRCReturnRC (autoCaller.rc()); 166 166 167 AutoRead erLock alock (this);167 AutoReadLock alock (this); 168 168 169 169 *aSupportsSeamless = mData.mSupportsSeamless; … … 180 180 CheckComRCReturnRC (autoCaller.rc()); 181 181 182 AutoRead erLock alock (this);182 AutoReadLock alock (this); 183 183 184 184 *aSupportsGraphics = mData.mSupportsGraphics; … … 195 195 CheckComRCReturnRC (autoCaller.rc()); 196 196 197 AutoRead erLock alock (this);197 AutoReadLock alock (this); 198 198 199 199 *aMemoryBalloonSize = mMemoryBalloonSize; … … 207 207 CheckComRCReturnRC (autoCaller.rc()); 208 208 209 Auto Lock alock (this);209 AutoWriteLock alock (this); 210 210 211 211 HRESULT ret = mParent->machine()->COMSETTER(MemoryBalloonSize)(aMemoryBalloonSize); … … 230 230 CheckComRCReturnRC (autoCaller.rc()); 231 231 232 AutoRead erLock alock (this);232 AutoReadLock alock (this); 233 233 234 234 *aUpdateInterval = mStatUpdateInterval; … … 242 242 CheckComRCReturnRC (autoCaller.rc()); 243 243 244 Auto Lock alock (this);244 AutoWriteLock alock (this); 245 245 246 246 HRESULT ret = mParent->machine()->COMSETTER(StatisticsUpdateInterval)(aUpdateInterval); … … 326 326 AssertComRCReturnVoid (autoCaller.rc()); 327 327 328 Auto Lock alock (this);328 AutoWriteLock alock (this); 329 329 330 330 mData.mAdditionsVersion = aVersion; … … 338 338 AssertComRCReturnVoid (autoCaller.rc()); 339 339 340 Auto Lock alock (this);340 AutoWriteLock alock (this); 341 341 342 342 mData.mSupportsSeamless = aSupportsSeamless; … … 348 348 AssertComRCReturnVoid (autoCaller.rc()); 349 349 350 Auto Lock alock (this);350 AutoWriteLock alock (this); 351 351 352 352 mData.mSupportsGraphics = aSupportsGraphics; -
trunk/src/VBox/Main/HardDiskAttachmentImpl.cpp
r7442 r8083 72 72 } 73 73 74 Auto Lock alock (this);74 AutoWriteLock alock (this); 75 75 76 76 mDirty = aDirty; … … 93 93 return E_POINTER; 94 94 95 Auto Lock alock (this);95 AutoWriteLock alock (this); 96 96 CHECK_READY(); 97 97 … … 107 107 return E_POINTER; 108 108 109 Auto Lock alock (this);109 AutoWriteLock alock (this); 110 110 CHECK_READY(); 111 111 … … 119 119 return E_INVALIDARG; 120 120 121 Auto Lock alock (this);121 AutoWriteLock alock (this); 122 122 CHECK_READY(); 123 123 … … 131 131 return E_INVALIDARG; 132 132 133 Auto Lock alock (this);133 AutoWriteLock alock (this); 134 134 CHECK_READY(); 135 135 -
trunk/src/VBox/Main/HardDiskImpl.cpp
r7992 r8083 163 163 * is forbidden. 164 164 */ 165 void HardDisk::protectedUninit (Auto Lock &alock)165 void HardDisk::protectedUninit (AutoWriteLock &alock) 166 166 { 167 167 LogFlowThisFunc (("\n")); … … 196 196 return E_POINTER; 197 197 198 AutoRead erLock alock (this);198 AutoReadLock alock (this); 199 199 CHECK_READY(); 200 200 … … 208 208 return E_POINTER; 209 209 210 AutoRead erLock alock (this);210 AutoReadLock alock (this); 211 211 CHECK_READY(); 212 212 … … 220 220 return E_POINTER; 221 221 222 AutoRead erLock alock (this);222 AutoReadLock alock (this); 223 223 CHECK_READY(); 224 224 … … 232 232 return E_POINTER; 233 233 234 AutoRead erLock alock (this);234 AutoReadLock alock (this); 235 235 CHECK_READY(); 236 236 … … 241 241 STDMETHODIMP HardDisk::COMSETTER(Type) (HardDiskType_T aType) 242 242 { 243 Auto Lock alock (this);243 AutoWriteLock alock (this); 244 244 CHECK_READY(); 245 245 … … 274 274 return E_POINTER; 275 275 276 AutoRead erLock alock (this);276 AutoReadLock alock (this); 277 277 CHECK_READY(); 278 278 … … 286 286 return E_POINTER; 287 287 288 AutoRead erLock lock(this);289 CHECK_READY(); 290 291 AutoRead erLock chLock (childrenLock());288 AutoReadLock lock(this); 289 CHECK_READY(); 290 291 AutoReadLock chLock (childrenLock()); 292 292 293 293 ComObjPtr <HardDiskCollection> collection; … … 303 303 return E_POINTER; 304 304 305 AutoRead erLock lock(this);305 AutoReadLock lock(this); 306 306 CHECK_READY(); 307 307 … … 315 315 return E_POINTER; 316 316 317 Auto Lock alock (this);317 AutoWriteLock alock (this); 318 318 CHECK_READY(); 319 319 … … 331 331 return E_POINTER; 332 332 333 Auto Lock alock (this);333 AutoWriteLock alock (this); 334 334 CHECK_READY(); 335 335 … … 342 342 while (parent) 343 343 { 344 Auto Lock parentLock (parent);344 AutoWriteLock parentLock (parent); 345 345 HRESULT rc = parent->getAccessible (mLastAccessError); 346 346 if (FAILED (rc)) … … 368 368 return E_POINTER; 369 369 370 AutoRead erLock alock (this);370 AutoReadLock alock (this); 371 371 CHECK_READY(); 372 372 … … 380 380 return E_POINTER; 381 381 382 AutoRead erLock alock (this);382 AutoReadLock alock (this); 383 383 CHECK_READY(); 384 384 … … 392 392 return E_POINTER; 393 393 394 AutoRead erLock alock (this);394 AutoReadLock alock (this); 395 395 CHECK_READY(); 396 396 … … 408 408 return E_POINTER; 409 409 410 Auto Lock alock (this);410 AutoWriteLock alock (this); 411 411 CHECK_READY(); 412 412 CHECK_BUSY(); … … 439 439 if (!RTPathHavePath (fp)) 440 440 { 441 AutoRead erLock propsLock (mVirtualBox->systemProperties());441 AutoReadLock propsLock (mVirtualBox->systemProperties()); 442 442 path = Utf8StrFmt ("%ls%c%s", 443 443 mVirtualBox->systemProperties()->defaultVDIFolder().raw(), … … 529 529 HRESULT HardDisk::trySetRegistered (BOOL aRegistered) 530 530 { 531 Auto Lock alock (this);531 AutoWriteLock alock (this); 532 532 CHECK_READY(); 533 533 … … 600 600 bool aCheckReaders /* = false */) 601 601 { 602 AutoRead erLock alock (this);602 AutoReadLock alock (this); 603 603 CHECK_READY(); 604 604 … … 636 636 bool HardDisk::sameAs (HardDisk *that) 637 637 { 638 AutoRead erLock alock (this);638 AutoReadLock alock (this); 639 639 if (!isReady()) 640 640 return false; … … 655 655 void HardDisk::setBusy() 656 656 { 657 Auto Lock alock (this);657 AutoWriteLock alock (this); 658 658 AssertReturnVoid (isReady()); 659 659 … … 669 669 void HardDisk::clearBusy() 670 670 { 671 Auto Lock alock (this);671 AutoWriteLock alock (this); 672 672 AssertReturnVoid (isReady()); 673 673 … … 684 684 void HardDisk::addReader() 685 685 { 686 Auto Lock alock (this);686 AutoWriteLock alock (this); 687 687 AssertReturnVoid (isReady()); 688 688 … … 697 697 void HardDisk::releaseReader() 698 698 { 699 Auto Lock alock (this);699 AutoWriteLock alock (this); 700 700 AssertReturnVoid (isReady()); 701 701 … … 711 711 void HardDisk::addReaderOnAncestors() 712 712 { 713 Auto Lock alock (this);713 AutoWriteLock alock (this); 714 714 AssertReturnVoid (isReady()); 715 715 716 716 if (mParent) 717 717 { 718 Auto Lock alock (mParent);718 AutoWriteLock alock (mParent); 719 719 mParent->addReader(); 720 720 mParent->addReaderOnAncestors(); … … 727 727 void HardDisk::releaseReaderOnAncestors() 728 728 { 729 Auto Lock alock (this);729 AutoWriteLock alock (this); 730 730 AssertReturnVoid (isReady()); 731 731 732 732 if (mParent) 733 733 { 734 Auto Lock alock (mParent);734 AutoWriteLock alock (mParent); 735 735 mParent->releaseReaderOnAncestors(); 736 736 mParent->releaseReader(); … … 744 744 bool HardDisk::hasForeignChildren() 745 745 { 746 AutoRead erLock alock (this);746 AutoReadLock alock (this); 747 747 AssertReturn (isReady(), false); 748 748 … … 750 750 751 751 /* check all children */ 752 AutoRead erLock chLock (childrenLock());752 AutoReadLock chLock (childrenLock()); 753 753 for (HardDiskList::const_iterator it = children().begin(); 754 754 it != children().end(); … … 756 756 { 757 757 ComObjPtr <HardDisk> child = *it; 758 AutoRead erLock childLock (child);758 AutoReadLock childLock (child); 759 759 if (child->mMachineId != mMachineId) 760 760 return true; … … 771 771 HRESULT HardDisk::setBusyWithChildren() 772 772 { 773 Auto Lock alock (this);773 AutoWriteLock alock (this); 774 774 AssertReturn (isReady(), E_FAIL); 775 775 … … 779 779 return setError (E_FAIL, errMsg, toString().raw()); 780 780 781 AutoRead erLock chLock (childrenLock());781 AutoReadLock chLock (childrenLock()); 782 782 783 783 for (HardDiskList::const_iterator it = children().begin(); … … 786 786 { 787 787 ComObjPtr <HardDisk> child = *it; 788 Auto Lock childLock (child);788 AutoWriteLock childLock (child); 789 789 if (child->mReaders > 0 || child->mBusy) 790 790 { … … 809 809 void HardDisk::clearBusyWithChildren() 810 810 { 811 Auto Lock alock (this);811 AutoWriteLock alock (this); 812 812 AssertReturn (isReady(), (void) 0); 813 813 814 814 AssertReturn (mBusy == true, (void) 0); 815 815 816 AutoRead erLock chLock (childrenLock());816 AutoReadLock chLock (childrenLock()); 817 817 818 818 for (HardDiskList::const_iterator it = children().begin(); … … 821 821 { 822 822 ComObjPtr <HardDisk> child = *it; 823 Auto Lock childLock (child);823 AutoWriteLock childLock (child); 824 824 Assert (child->mBusy == true); 825 825 child->mBusy = false; … … 837 837 { 838 838 /* getAccessible() needs a write lock */ 839 Auto Lock alock (this);839 AutoWriteLock alock (this); 840 840 AssertReturn (isReady(), E_FAIL); 841 841 … … 844 844 return rc; 845 845 846 AutoRead erLock chLock (childrenLock());846 AutoReadLock chLock (childrenLock()); 847 847 848 848 for (HardDiskList::const_iterator it = children().begin(); … … 872 872 HRESULT HardDisk::checkConsistency() 873 873 { 874 AutoRead erLock alock (this);874 AutoReadLock alock (this); 875 875 AssertReturn (isReady(), E_FAIL); 876 876 … … 889 889 HRESULT rc = S_OK; 890 890 891 AutoRead erLock chLock (childrenLock());891 AutoReadLock chLock (childrenLock()); 892 892 893 893 if (mParent.isNull() && mType == HardDiskType_Normal && … … 941 941 E_FAIL); 942 942 943 Auto Lock alock (this);943 AutoWriteLock alock (this); 944 944 CHECK_READY(); 945 945 … … 1019 1019 AssertReturnVoid (aNewPath); 1020 1020 1021 Auto Lock alock (this);1021 AutoWriteLock alock (this); 1022 1022 AssertReturnVoid (isReady()); 1023 1023 … … 1025 1025 1026 1026 /* update paths of all children */ 1027 AutoRead erLock chLock (childrenLock());1027 AutoReadLock chLock (childrenLock()); 1028 1028 for (HardDiskList::const_iterator it = children().begin(); 1029 1029 it != children().end(); … … 1296 1296 1297 1297 /* save all children */ 1298 AutoRead erLock chLock (childrenLock());1298 AutoReadLock chLock (childrenLock()); 1299 1299 for (HardDiskList::const_iterator it = children().begin(); 1300 1300 it != children().end(); … … 1302 1302 { 1303 1303 ComObjPtr <HardDisk> child = *it; 1304 AutoRead erLock childLock (child);1304 AutoReadLock childLock (child); 1305 1305 1306 1306 Key hdNode = aHDNode.appendKey ("DiffHardDisk"); … … 1369 1369 AssertReturn (!aHDNode.isNull() && !aVDINode.isNull(), E_FAIL); 1370 1370 1371 Auto Lock alock (this);1371 AutoWriteLock alock (this); 1372 1372 ComAssertRet (!isReady(), E_UNEXPECTED); 1373 1373 … … 1428 1428 aFilePath, aRegistered)); 1429 1429 1430 Auto Lock alock (this);1430 AutoWriteLock alock (this); 1431 1431 ComAssertRet (!isReady(), E_UNEXPECTED); 1432 1432 … … 1494 1494 LogFlowThisFunc (("\n")); 1495 1495 1496 Auto Lock alock (this);1496 AutoWriteLock alock (this); 1497 1497 if (!isReady()) 1498 1498 return; … … 1509 1509 return E_POINTER; 1510 1510 1511 AutoRead erLock alock (this);1511 AutoReadLock alock (this); 1512 1512 CHECK_READY(); 1513 1513 … … 1518 1518 STDMETHODIMP HVirtualDiskImage::COMSETTER(Description) (INPTR BSTR aDescription) 1519 1519 { 1520 Auto Lock alock (this);1520 AutoWriteLock alock (this); 1521 1521 CHECK_READY(); 1522 1522 … … 1542 1542 return E_POINTER; 1543 1543 1544 AutoRead erLock alock (this);1544 AutoReadLock alock (this); 1545 1545 CHECK_READY(); 1546 1546 … … 1558 1558 return E_POINTER; 1559 1559 1560 AutoRead erLock alock (this);1560 AutoReadLock alock (this); 1561 1561 CHECK_READY(); 1562 1562 … … 1573 1573 return E_POINTER; 1574 1574 1575 AutoRead erLock alock (this);1575 AutoReadLock alock (this); 1576 1576 CHECK_READY(); 1577 1577 … … 1582 1582 STDMETHODIMP HVirtualDiskImage::COMSETTER(FilePath) (INPTR BSTR aFilePath) 1583 1583 { 1584 Auto Lock alock (this);1584 AutoWriteLock alock (this); 1585 1585 CHECK_READY(); 1586 1586 … … 1599 1599 if (!RTPathHavePath (fp)) 1600 1600 { 1601 AutoRead erLock propsLock (mVirtualBox->systemProperties());1601 AutoReadLock propsLock (mVirtualBox->systemProperties()); 1602 1602 path = Utf8StrFmt ("%ls%c%s", 1603 1603 mVirtualBox->systemProperties()->defaultVDIFolder().raw(), … … 1615 1615 return E_POINTER; 1616 1616 1617 AutoRead erLock alock (this);1617 AutoReadLock alock (this); 1618 1618 CHECK_READY(); 1619 1619 … … 1630 1630 return E_POINTER; 1631 1631 1632 Auto Lock alock (this);1632 AutoWriteLock alock (this); 1633 1633 CHECK_READY(); 1634 1634 … … 1641 1641 return E_POINTER; 1642 1642 1643 Auto Lock alock (this);1643 AutoWriteLock alock (this); 1644 1644 CHECK_READY(); 1645 1645 … … 1649 1649 STDMETHODIMP HVirtualDiskImage::DeleteImage() 1650 1650 { 1651 Auto Lock alock (this);1651 AutoWriteLock alock (this); 1652 1652 CHECK_READY(); 1653 1653 CHECK_BUSY_AND_READERS(); … … 1682 1682 HRESULT HVirtualDiskImage::trySetRegistered (BOOL aRegistered) 1683 1683 { 1684 Auto Lock alock (this);1684 AutoWriteLock alock (this); 1685 1685 CHECK_READY(); 1686 1686 … … 1717 1717 { 1718 1718 /* queryInformation() needs a write lock */ 1719 Auto Lock alock (this);1719 AutoWriteLock alock (this); 1720 1720 CHECK_READY(); 1721 1721 … … 1773 1773 AssertReturn (!aHDNode.isNull() && !aStorageNode.isNull(), E_FAIL); 1774 1774 1775 AutoRead erLock alock (this);1775 AutoReadLock alock (this); 1776 1776 CHECK_READY(); 1777 1777 … … 1798 1798 AssertReturnVoid (aNewPath); 1799 1799 1800 Auto Lock alock (this);1800 AutoWriteLock alock (this); 1801 1801 AssertReturnVoid (isReady()); 1802 1802 … … 1833 1833 Bstr HVirtualDiskImage::toString (bool aShort /* = false */) 1834 1834 { 1835 AutoRead erLock alock (this);1835 AutoReadLock alock (this); 1836 1836 1837 1837 if (!aShort) … … 1868 1868 AssertReturn (aProgress, E_FAIL); 1869 1869 1870 Auto Lock alock (this);1870 AutoWriteLock alock (this); 1871 1871 AssertReturn (isReady(), E_FAIL); 1872 1872 … … 1924 1924 AssertReturn (!aTargetPath.isNull(), E_FAIL); 1925 1925 1926 Auto Lock alock (this);1926 AutoWriteLock alock (this); 1927 1927 AssertReturn (isReady(), E_FAIL); 1928 1928 … … 1979 1979 E_FAIL); 1980 1980 1981 Auto Lock alock (this);1981 AutoWriteLock alock (this); 1982 1982 CHECK_READY(); 1983 1983 … … 2094 2094 LogFlowThisFunc (("mFilePathFull='%ls'\n", mFilePathFull.raw())); 2095 2095 2096 Auto Lock alock (this);2096 AutoWriteLock alock (this); 2097 2097 CHECK_READY(); 2098 2098 2099 2099 AssertReturn (!mParent.isNull(), E_FAIL); 2100 Auto Lock parentLock (mParent);2100 AutoWriteLock parentLock (mParent); 2101 2101 2102 2102 ComAssertRet (isBusy() == true, E_FAIL); … … 2127 2127 HRESULT rc = S_OK; 2128 2128 2129 AutoRead erLock chLock (childrenLock());2129 AutoReadLock chLock (childrenLock()); 2130 2130 2131 2131 for (HardDiskList::const_iterator it = children().begin(); … … 2133 2133 { 2134 2134 ComObjPtr <HVirtualDiskImage> child = (*it)->asVDI(); 2135 Auto Lock childLock (child);2135 AutoWriteLock childLock (child); 2136 2136 2137 2137 /* reparent the child */ … … 2208 2208 LogFlowThisFunc (("mFilePathFull='%ls'\n", mFilePathFull.raw())); 2209 2209 2210 Auto Lock alock (this);2210 AutoWriteLock alock (this); 2211 2211 CHECK_READY(); 2212 2212 … … 2223 2223 HRESULT rc = S_OK; 2224 2224 2225 Auto Lock chLock (childrenLock());2225 AutoWriteLock chLock (childrenLock ()); 2226 2226 2227 2227 /* iterate over a copy since we will modify the list */ … … 2233 2233 ComObjPtr <HardDisk> hd = *it; 2234 2234 ComObjPtr <HVirtualDiskImage> child = hd->asVDI(); 2235 Auto Lock childLock (child);2235 AutoWriteLock childLock (child); 2236 2236 2237 2237 ComAssertRet (child->isBusy() == true, E_FAIL); … … 2307 2307 HRESULT HVirtualDiskImage::wipeOutImage() 2308 2308 { 2309 Auto Lock alock (this);2309 AutoWriteLock alock (this); 2310 2310 CHECK_READY(); 2311 2311 … … 2342 2342 HRESULT HVirtualDiskImage::deleteImage (bool aIgnoreErrors /* = false */) 2343 2343 { 2344 Auto Lock alock (this);2344 AutoWriteLock alock (this); 2345 2345 CHECK_READY(); 2346 2346 … … 2401 2401 HRESULT HVirtualDiskImage::queryInformation (Bstr *aAccessError) 2402 2402 { 2403 AssertReturn (is LockedOnCurrentThread(), E_FAIL);2403 AssertReturn (isWriteLockOnCurrentThread(), E_FAIL); 2404 2404 2405 2405 /* create a lock object to completely release it later */ 2406 Auto Lock alock (this);2406 AutoWriteLock alock (this); 2407 2407 2408 2408 AssertReturn (mStateCheckWaiters == 0, E_FAIL); … … 2461 2461 { 2462 2462 /* check parent UUID */ 2463 Auto Lock parentLock (mParent);2463 AutoWriteLock parentLock (mParent); 2464 2464 if (mParent->id() != parentId) 2465 2465 { … … 2577 2577 IProgress **aProgress) 2578 2578 { 2579 Auto Lock alock (this);2579 AutoWriteLock alock (this); 2580 2580 2581 2581 CHECK_BUSY_AND_READERS(); … … 2716 2716 Assert (!task->vdi->id().isEmpty()); 2717 2717 /// @todo (dmik) check locks 2718 Auto Lock sourceLock (task->source);2718 AutoWriteLock sourceLock (task->source); 2719 2719 rc = task->source->cloneToImage (task->vdi->id(), 2720 2720 Utf8Str (task->vdi->filePathFull()), … … 2754 2754 LogFlowFunc (("rc=%08X\n", rc)); 2755 2755 2756 Auto Lock alock (task->vdi);2756 AutoWriteLock alock (task->vdi); 2757 2757 2758 2758 /* clear busy set in in HardDisk::CloneToImage() or … … 2847 2847 AssertReturn (!aHDNode.isNull() && !aISCSINode.isNull(), E_FAIL); 2848 2848 2849 Auto Lock alock (this);2849 AutoWriteLock alock (this); 2850 2850 ComAssertRet (!isReady(), E_UNEXPECTED); 2851 2851 … … 2911 2911 LogFlowThisFunc (("\n")); 2912 2912 2913 Auto Lock alock (this);2913 AutoWriteLock alock (this); 2914 2914 ComAssertRet (!isReady(), E_UNEXPECTED); 2915 2915 … … 2949 2949 LogFlowThisFunc (("\n")); 2950 2950 2951 Auto Lock alock (this);2951 AutoWriteLock alock (this); 2952 2952 if (!isReady()) 2953 2953 return; … … 2964 2964 return E_POINTER; 2965 2965 2966 AutoRead erLock alock (this);2966 AutoReadLock alock (this); 2967 2967 CHECK_READY(); 2968 2968 … … 2973 2973 STDMETHODIMP HISCSIHardDisk::COMSETTER(Description) (INPTR BSTR aDescription) 2974 2974 { 2975 Auto Lock alock (this);2975 AutoWriteLock alock (this); 2976 2976 CHECK_READY(); 2977 2977 … … 2993 2993 return E_POINTER; 2994 2994 2995 AutoRead erLock alock (this);2995 AutoReadLock alock (this); 2996 2996 CHECK_READY(); 2997 2997 … … 3005 3005 return E_POINTER; 3006 3006 3007 AutoRead erLock alock (this);3007 AutoReadLock alock (this); 3008 3008 CHECK_READY(); 3009 3009 … … 3020 3020 return E_POINTER; 3021 3021 3022 AutoRead erLock alock (this);3022 AutoReadLock alock (this); 3023 3023 CHECK_READY(); 3024 3024 … … 3032 3032 return E_INVALIDARG; 3033 3033 3034 Auto Lock alock (this);3034 AutoWriteLock alock (this); 3035 3035 CHECK_READY(); 3036 3036 … … 3052 3052 return E_POINTER; 3053 3053 3054 AutoRead erLock alock (this);3054 AutoReadLock alock (this); 3055 3055 CHECK_READY(); 3056 3056 … … 3061 3061 STDMETHODIMP HISCSIHardDisk::COMSETTER(Port) (USHORT aPort) 3062 3062 { 3063 Auto Lock alock (this);3063 AutoWriteLock alock (this); 3064 3064 CHECK_READY(); 3065 3065 … … 3081 3081 return E_POINTER; 3082 3082 3083 AutoRead erLock alock (this);3083 AutoReadLock alock (this); 3084 3084 CHECK_READY(); 3085 3085 … … 3093 3093 return E_INVALIDARG; 3094 3094 3095 Auto Lock alock (this);3095 AutoWriteLock alock (this); 3096 3096 CHECK_READY(); 3097 3097 … … 3113 3113 return E_POINTER; 3114 3114 3115 AutoRead erLock alock (this);3115 AutoReadLock alock (this); 3116 3116 CHECK_READY(); 3117 3117 … … 3122 3122 STDMETHODIMP HISCSIHardDisk::COMSETTER(Lun) (ULONG64 aLun) 3123 3123 { 3124 Auto Lock alock (this);3124 AutoWriteLock alock (this); 3125 3125 CHECK_READY(); 3126 3126 … … 3142 3142 return E_POINTER; 3143 3143 3144 AutoRead erLock alock (this);3144 AutoReadLock alock (this); 3145 3145 CHECK_READY(); 3146 3146 … … 3151 3151 STDMETHODIMP HISCSIHardDisk::COMSETTER(UserName) (INPTR BSTR aUserName) 3152 3152 { 3153 Auto Lock alock (this);3153 AutoWriteLock alock (this); 3154 3154 CHECK_READY(); 3155 3155 … … 3171 3171 return E_POINTER; 3172 3172 3173 AutoRead erLock alock (this);3173 AutoReadLock alock (this); 3174 3174 CHECK_READY(); 3175 3175 … … 3180 3180 STDMETHODIMP HISCSIHardDisk::COMSETTER(Password) (INPTR BSTR aPassword) 3181 3181 { 3182 Auto Lock alock (this);3182 AutoWriteLock alock (this); 3183 3183 CHECK_READY(); 3184 3184 … … 3204 3204 HRESULT HISCSIHardDisk::trySetRegistered (BOOL aRegistered) 3205 3205 { 3206 Auto Lock alock (this);3206 AutoWriteLock alock (this); 3207 3207 CHECK_READY(); 3208 3208 … … 3228 3228 { 3229 3229 /* queryInformation() needs a write lock */ 3230 Auto Lock alock (this);3230 AutoWriteLock alock (this); 3231 3231 CHECK_READY(); 3232 3232 … … 3251 3251 AssertReturn (!aHDNode.isNull() && !aStorageNode.isNull(), E_FAIL); 3252 3252 3253 AutoRead erLock alock (this);3253 AutoReadLock alock (this); 3254 3254 CHECK_READY(); 3255 3255 … … 3283 3283 Bstr HISCSIHardDisk::toString (bool aShort /* = false */) 3284 3284 { 3285 AutoRead erLock alock (this);3285 AutoReadLock alock (this); 3286 3286 3287 3287 Bstr str; … … 3365 3365 HRESULT HISCSIHardDisk::queryInformation (Bstr &aAccessError) 3366 3366 { 3367 AssertReturn (is LockedOnCurrentThread(), E_FAIL);3367 AssertReturn (isWriteLockOnCurrentThread(), E_FAIL); 3368 3368 3369 3369 /* create a lock object to completely release it later */ 3370 Auto Lock alock (this);3370 AutoWriteLock alock (this); 3371 3371 3372 3372 /// @todo (dmik) query info about this iSCSI disk, … … 3438 3438 AssertReturn (!aHDNode.isNull() && !aVMDKNode.isNull(), E_FAIL); 3439 3439 3440 Auto Lock alock (this);3440 AutoWriteLock alock (this); 3441 3441 ComAssertRet (!isReady(), E_UNEXPECTED); 3442 3442 … … 3507 3507 AssertReturn (aParent == NULL, E_FAIL); 3508 3508 3509 Auto Lock alock (this);3509 AutoWriteLock alock (this); 3510 3510 ComAssertRet (!isReady(), E_UNEXPECTED); 3511 3511 … … 3576 3576 LogFlowThisFunc (("\n")); 3577 3577 3578 Auto Lock alock (this);3578 AutoWriteLock alock (this); 3579 3579 if (!isReady()) 3580 3580 return; … … 3591 3591 return E_POINTER; 3592 3592 3593 AutoRead erLock alock (this);3593 AutoReadLock alock (this); 3594 3594 CHECK_READY(); 3595 3595 … … 3600 3600 STDMETHODIMP HVMDKImage::COMSETTER(Description) (INPTR BSTR aDescription) 3601 3601 { 3602 Auto Lock alock (this);3602 AutoWriteLock alock (this); 3603 3603 CHECK_READY(); 3604 3604 … … 3628 3628 return E_POINTER; 3629 3629 3630 AutoRead erLock alock (this);3630 AutoReadLock alock (this); 3631 3631 CHECK_READY(); 3632 3632 … … 3646 3646 return E_POINTER; 3647 3647 3648 AutoRead erLock alock (this);3648 AutoReadLock alock (this); 3649 3649 CHECK_READY(); 3650 3650 … … 3661 3661 return E_POINTER; 3662 3662 3663 AutoRead erLock alock (this);3663 AutoReadLock alock (this); 3664 3664 CHECK_READY(); 3665 3665 … … 3670 3670 STDMETHODIMP HVMDKImage::COMSETTER(FilePath) (INPTR BSTR aFilePath) 3671 3671 { 3672 Auto Lock alock (this);3672 AutoWriteLock alock (this); 3673 3673 CHECK_READY(); 3674 3674 … … 3687 3687 if (!RTPathHavePath (fp)) 3688 3688 { 3689 AutoRead erLock propsLock (mVirtualBox->systemProperties());3689 AutoReadLock propsLock (mVirtualBox->systemProperties()); 3690 3690 path = Utf8StrFmt ("%ls%c%s", 3691 3691 mVirtualBox->systemProperties()->defaultVDIFolder().raw(), … … 3703 3703 return E_POINTER; 3704 3704 3705 AutoRead erLock alock (this);3705 AutoReadLock alock (this); 3706 3706 CHECK_READY(); 3707 3707 … … 3718 3718 return E_POINTER; 3719 3719 3720 Auto Lock alock (this);3720 AutoWriteLock alock (this); 3721 3721 CHECK_READY(); 3722 3722 … … 3729 3729 return E_POINTER; 3730 3730 3731 Auto Lock alock (this);3731 AutoWriteLock alock (this); 3732 3732 CHECK_READY(); 3733 3733 … … 3737 3737 STDMETHODIMP HVMDKImage::DeleteImage() 3738 3738 { 3739 Auto Lock alock (this);3739 AutoWriteLock alock (this); 3740 3740 CHECK_READY(); 3741 3741 CHECK_BUSY_AND_READERS(); … … 3780 3780 HRESULT HVMDKImage::trySetRegistered (BOOL aRegistered) 3781 3781 { 3782 Auto Lock alock (this);3782 AutoWriteLock alock (this); 3783 3783 CHECK_READY(); 3784 3784 … … 3817 3817 { 3818 3818 /* queryInformation() needs a write lock */ 3819 Auto Lock alock (this);3819 AutoWriteLock alock (this); 3820 3820 CHECK_READY(); 3821 3821 … … 3873 3873 AssertReturn (!aHDNode.isNull() && !aStorageNode.isNull(), E_FAIL); 3874 3874 3875 AutoRead erLock alock (this);3875 AutoReadLock alock (this); 3876 3876 CHECK_READY(); 3877 3877 … … 3898 3898 AssertReturnVoid (aNewPath); 3899 3899 3900 Auto Lock alock (this);3900 AutoWriteLock alock (this); 3901 3901 AssertReturnVoid (isReady()); 3902 3902 … … 3933 3933 Bstr HVMDKImage::toString (bool aShort /* = false */) 3934 3934 { 3935 AutoRead erLock alock (this);3935 AutoReadLock alock (this); 3936 3936 3937 3937 if (!aShort) … … 4032 4032 HRESULT HVMDKImage::queryInformation (Bstr *aAccessError) 4033 4033 { 4034 AssertReturn (is LockedOnCurrentThread(), E_FAIL);4034 AssertReturn (isWriteLockOnCurrentThread(), E_FAIL); 4035 4035 4036 4036 /* create a lock object to completely release it later */ 4037 Auto Lock alock (this);4037 AutoWriteLock alock (this); 4038 4038 4039 4039 AssertReturn (mStateCheckWaiters == 0, E_FAIL); … … 4105 4105 { 4106 4106 /* check parent UUID */ 4107 Auto Lock parentLock (mParent);4107 AutoWriteLock parentLock (mParent); 4108 4108 if (mParent->id() != parentId) 4109 4109 { … … 4314 4314 AssertReturn (!aHDNode.isNull() && !aCustomNode.isNull(), E_FAIL); 4315 4315 4316 Auto Lock alock (this);4316 AutoWriteLock alock (this); 4317 4317 ComAssertRet (!isReady(), E_UNEXPECTED); 4318 4318 … … 4401 4401 AssertReturn (aParent == NULL, E_FAIL); 4402 4402 4403 Auto Lock alock (this);4403 AutoWriteLock alock (this); 4404 4404 ComAssertRet (!isReady(), E_UNEXPECTED); 4405 4405 … … 4491 4491 LogFlowThisFunc (("\n")); 4492 4492 4493 Auto Lock alock (this);4493 AutoWriteLock alock (this); 4494 4494 if (!isReady()) 4495 4495 return; … … 4506 4506 return E_POINTER; 4507 4507 4508 AutoRead erLock alock (this);4508 AutoReadLock alock (this); 4509 4509 CHECK_READY(); 4510 4510 … … 4515 4515 STDMETHODIMP HCustomHardDisk::COMSETTER(Description) (INPTR BSTR aDescription) 4516 4516 { 4517 Auto Lock alock (this);4517 AutoWriteLock alock (this); 4518 4518 CHECK_READY(); 4519 4519 … … 4528 4528 return E_POINTER; 4529 4529 4530 AutoRead erLock alock (this);4530 AutoReadLock alock (this); 4531 4531 CHECK_READY(); 4532 4532 … … 4540 4540 return E_POINTER; 4541 4541 4542 AutoRead erLock alock (this);4542 AutoReadLock alock (this); 4543 4543 CHECK_READY(); 4544 4544 … … 4555 4555 return E_POINTER; 4556 4556 4557 AutoRead erLock alock (this);4557 AutoReadLock alock (this); 4558 4558 CHECK_READY(); 4559 4559 … … 4564 4564 STDMETHODIMP HCustomHardDisk::COMSETTER(Location) (INPTR BSTR aLocation) 4565 4565 { 4566 Auto Lock alock (this);4566 AutoWriteLock alock (this); 4567 4567 CHECK_READY(); 4568 4568 … … 4585 4585 if (!RTPathHavePath (fp)) 4586 4586 { 4587 AutoRead erLock propsLock (mVirtualBox->systemProperties());4587 AutoReadLock propsLock (mVirtualBox->systemProperties()); 4588 4588 path = Utf8StrFmt ("%ls%c%s", 4589 4589 mVirtualBox->systemProperties()->defaultVDIFolder().raw(), … … 4601 4601 return E_POINTER; 4602 4602 4603 AutoRead erLock alock (this);4603 AutoReadLock alock (this); 4604 4604 CHECK_READY(); 4605 4605 … … 4613 4613 return E_POINTER; 4614 4614 4615 AutoRead erLock alock (this);4615 AutoReadLock alock (this); 4616 4616 CHECK_READY(); 4617 4617 … … 4628 4628 return E_POINTER; 4629 4629 4630 Auto Lock alock (this);4630 AutoWriteLock alock (this); 4631 4631 CHECK_READY(); 4632 4632 … … 4639 4639 return E_POINTER; 4640 4640 4641 Auto Lock alock (this);4641 AutoWriteLock alock (this); 4642 4642 CHECK_READY(); 4643 4643 … … 4647 4647 STDMETHODIMP HCustomHardDisk::DeleteImage() 4648 4648 { 4649 Auto Lock alock (this);4649 AutoWriteLock alock (this); 4650 4650 CHECK_READY(); 4651 4651 CHECK_BUSY_AND_READERS(); … … 4665 4665 HRESULT HCustomHardDisk::trySetRegistered (BOOL aRegistered) 4666 4666 { 4667 Auto Lock alock (this);4667 AutoWriteLock alock (this); 4668 4668 CHECK_READY(); 4669 4669 … … 4695 4695 { 4696 4696 /* queryInformation() needs a write lock */ 4697 Auto Lock alock (this);4697 AutoWriteLock alock (this); 4698 4698 CHECK_READY(); 4699 4699 … … 4751 4751 AssertReturn (!aHDNode.isNull() && !aStorageNode.isNull(), E_FAIL); 4752 4752 4753 AutoRead erLock alock (this);4753 AutoReadLock alock (this); 4754 4754 CHECK_READY(); 4755 4755 … … 4775 4775 Bstr HCustomHardDisk::toString (bool aShort /* = false */) 4776 4776 { 4777 AutoRead erLock alock (this);4777 AutoReadLock alock (this); 4778 4778 4779 4779 /// @todo currently, we assume that location is always a file path for … … 4875 4875 HRESULT HCustomHardDisk::queryInformation (Bstr *aAccessError) 4876 4876 { 4877 AssertReturn (is LockedOnCurrentThread(), E_FAIL);4877 AssertReturn (isWriteLockOnCurrentThread(), E_FAIL); 4878 4878 4879 4879 /* create a lock object to completely release it later */ 4880 Auto Lock alock (this);4880 AutoWriteLock alock (this); 4881 4881 4882 4882 AssertReturn (mStateCheckWaiters == 0, E_FAIL); … … 4943 4943 { 4944 4944 /* check parent UUID */ 4945 Auto Lock parentLock (mParent);4945 AutoWriteLock parentLock (mParent); 4946 4946 if (mParent->id() != parentId) 4947 4947 { … … 5145 5145 AssertReturn (!aHDNode.isNull() && !aVHDNode.isNull(), E_FAIL); 5146 5146 5147 Auto Lock alock (this);5147 AutoWriteLock alock (this); 5148 5148 ComAssertRet (!isReady(), E_UNEXPECTED); 5149 5149 … … 5215 5215 AssertReturn (aParent == NULL, E_FAIL); 5216 5216 5217 Auto Lock alock (this);5217 AutoWriteLock alock (this); 5218 5218 ComAssertRet (!isReady(), E_UNEXPECTED); 5219 5219 … … 5284 5284 LogFlowThisFunc (("\n")); 5285 5285 5286 Auto Lock alock (this);5286 AutoWriteLock alock (this); 5287 5287 if (!isReady()) 5288 5288 return; … … 5299 5299 return E_POINTER; 5300 5300 5301 AutoRead erLock alock (this);5301 AutoReadLock alock (this); 5302 5302 CHECK_READY(); 5303 5303 … … 5308 5308 STDMETHODIMP HVHDImage::COMSETTER(Description) (INPTR BSTR aDescription) 5309 5309 { 5310 Auto Lock alock (this);5310 AutoWriteLock alock (this); 5311 5311 CHECK_READY(); 5312 5312 … … 5336 5336 return E_POINTER; 5337 5337 5338 AutoRead erLock alock (this);5338 AutoReadLock alock (this); 5339 5339 CHECK_READY(); 5340 5340 … … 5354 5354 return E_POINTER; 5355 5355 5356 AutoRead erLock alock (this);5356 AutoReadLock alock (this); 5357 5357 CHECK_READY(); 5358 5358 … … 5369 5369 return E_POINTER; 5370 5370 5371 AutoRead erLock alock (this);5371 AutoReadLock alock (this); 5372 5372 CHECK_READY(); 5373 5373 … … 5378 5378 STDMETHODIMP HVHDImage::COMSETTER(FilePath) (INPTR BSTR aFilePath) 5379 5379 { 5380 Auto Lock alock (this);5380 AutoWriteLock alock (this); 5381 5381 CHECK_READY(); 5382 5382 … … 5395 5395 if (!RTPathHavePath (fp)) 5396 5396 { 5397 AutoRead erLock propsLock (mVirtualBox->systemProperties());5397 AutoReadLock propsLock (mVirtualBox->systemProperties()); 5398 5398 path = Utf8StrFmt ("%ls%c%s", 5399 5399 mVirtualBox->systemProperties()->defaultVDIFolder().raw(), … … 5411 5411 return E_POINTER; 5412 5412 5413 AutoRead erLock alock (this);5413 AutoReadLock alock (this); 5414 5414 CHECK_READY(); 5415 5415 … … 5426 5426 return E_POINTER; 5427 5427 5428 Auto Lock alock (this);5428 AutoWriteLock alock (this); 5429 5429 CHECK_READY(); 5430 5430 … … 5437 5437 return E_POINTER; 5438 5438 5439 Auto Lock alock (this);5439 AutoWriteLock alock (this); 5440 5440 CHECK_READY(); 5441 5441 … … 5445 5445 STDMETHODIMP HVHDImage::DeleteImage() 5446 5446 { 5447 Auto Lock alock (this);5447 AutoWriteLock alock (this); 5448 5448 CHECK_READY(); 5449 5449 CHECK_BUSY_AND_READERS(); … … 5488 5488 HRESULT HVHDImage::trySetRegistered (BOOL aRegistered) 5489 5489 { 5490 Auto Lock alock (this);5490 AutoWriteLock alock (this); 5491 5491 CHECK_READY(); 5492 5492 … … 5525 5525 { 5526 5526 /* queryInformation() needs a write lock */ 5527 Auto Lock alock (this);5527 AutoWriteLock alock (this); 5528 5528 CHECK_READY(); 5529 5529 … … 5580 5580 AssertReturn (!aHDNode.isNull() && !aStorageNode.isNull(), E_FAIL); 5581 5581 5582 AutoRead erLock alock (this);5582 AutoReadLock alock (this); 5583 5583 CHECK_READY(); 5584 5584 … … 5605 5605 AssertReturnVoid (aNewPath); 5606 5606 5607 Auto Lock alock (this);5607 AutoWriteLock alock (this); 5608 5608 AssertReturnVoid (isReady()); 5609 5609 … … 5640 5640 Bstr HVHDImage::toString (bool aShort /* = false */) 5641 5641 { 5642 AutoRead erLock alock (this);5642 AutoReadLock alock (this); 5643 5643 5644 5644 if (!aShort) … … 5739 5739 HRESULT HVHDImage::queryInformation (Bstr *aAccessError) 5740 5740 { 5741 AssertReturn (is LockedOnCurrentThread(), E_FAIL);5741 AssertReturn (isWriteLockOnCurrentThread(), E_FAIL); 5742 5742 5743 5743 /* create a lock object to completely release it later */ 5744 Auto Lock alock (this);5744 AutoWriteLock alock (this); 5745 5745 5746 5746 AssertReturn (mStateCheckWaiters == 0, E_FAIL); … … 5812 5812 { 5813 5813 /* check parent UUID */ 5814 Auto Lock parentLock (mParent);5814 AutoWriteLock parentLock (mParent); 5815 5815 if (mParent->id() != parentId) 5816 5816 { -
trunk/src/VBox/Main/HostImpl.cpp
r7964 r8083 135 135 ComAssertRet (parent, E_INVALIDARG); 136 136 137 Auto Lock lock(this);137 AutoWriteLock alock (this); 138 138 ComAssertRet (!isReady(), E_UNEXPECTED); 139 139 … … 202 202 if (!drives) 203 203 return E_POINTER; 204 Auto Lock lock(this);204 AutoWriteLock alock (this); 205 205 CHECK_READY(); 206 206 std::list <ComObjPtr <HostDVDDrive> > list; … … 351 351 if (!drives) 352 352 return E_POINTER; 353 Auto Lock lock(this);353 AutoWriteLock alock (this); 354 354 CHECK_READY(); 355 355 … … 504 504 if (!networkInterfaces) 505 505 return E_POINTER; 506 Auto Lock lock(this);506 AutoWriteLock alock (this); 507 507 CHECK_READY(); 508 508 … … 579 579 return E_POINTER; 580 580 581 Auto Lock alock (this);581 AutoWriteLock alock (this); 582 582 CHECK_READY(); 583 583 … … 605 605 return E_POINTER; 606 606 607 Auto Lock alock (this);607 AutoWriteLock alock (this); 608 608 CHECK_READY(); 609 609 … … 635 635 if (!count) 636 636 return E_POINTER; 637 Auto Lock lock(this);637 AutoWriteLock alock (this); 638 638 CHECK_READY(); 639 639 *count = RTSystemProcessorGetCount(); … … 651 651 if (!speed) 652 652 return E_POINTER; 653 Auto Lock lock(this);653 AutoWriteLock alock (this); 654 654 CHECK_READY(); 655 655 /** @todo Add a runtime function for this which uses GIP. */ … … 666 666 if (!description) 667 667 return E_POINTER; 668 Auto Lock lock(this);668 AutoWriteLock alock (this); 669 669 CHECK_READY(); 670 670 /** @todo */ … … 683 683 if (!size) 684 684 return E_POINTER; 685 Auto Lock lock(this);685 AutoWriteLock alock (this); 686 686 CHECK_READY(); 687 687 /** @todo */ … … 699 699 if (!available) 700 700 return E_POINTER; 701 Auto Lock lock(this);701 AutoWriteLock alock (this); 702 702 CHECK_READY(); 703 703 /** @todo */ … … 715 715 if (!os) 716 716 return E_POINTER; 717 Auto Lock lock(this);717 AutoWriteLock alock (this); 718 718 CHECK_READY(); 719 719 /** @todo */ … … 731 731 if (!version) 732 732 return E_POINTER; 733 Auto Lock lock(this);733 AutoWriteLock alock (this); 734 734 CHECK_READY(); 735 735 /** @todo */ … … 747 747 if (!aUTCTime) 748 748 return E_POINTER; 749 Auto Lock lock(this);749 AutoWriteLock alock (this); 750 750 CHECK_READY(); 751 751 RTTIMESPEC now; … … 829 829 return E_POINTER; 830 830 831 Auto Locklock (this);831 AutoWriteLock alock (this); 832 832 CHECK_READY(); 833 833 … … 893 893 return E_POINTER; 894 894 895 Auto Locklock (this);895 AutoWriteLock alock (this); 896 896 CHECK_READY(); 897 897 … … 956 956 return E_INVALIDARG; 957 957 958 Auto Locklock (this);958 AutoWriteLock alock (this); 959 959 CHECK_READY(); 960 960 … … 980 980 return E_INVALIDARG; 981 981 982 Auto Lock alock (this);982 AutoWriteLock alock (this); 983 983 CHECK_READY(); 984 984 … … 1027 1027 return E_POINTER; 1028 1028 1029 Auto Lock alock (this);1029 AutoWriteLock alock (this); 1030 1030 CHECK_READY(); 1031 1031 … … 1082 1082 using namespace settings; 1083 1083 1084 Auto Locklock (this);1084 AutoWriteLock alock (this); 1085 1085 CHECK_READY(); 1086 1086 … … 1144 1144 using namespace settings; 1145 1145 1146 Auto Locklock (this);1146 AutoWriteLock alock (this); 1147 1147 CHECK_READY(); 1148 1148 … … 1160 1160 while (it != mUSBDeviceFilters.end()) 1161 1161 { 1162 Auto Lock filterLock (*it);1162 AutoWriteLock filterLock (*it); 1163 1163 const HostUSBDeviceFilter::Data &data = (*it)->data(); 1164 1164 … … 1223 1223 BOOL aActiveChanged /* = FALSE */) 1224 1224 { 1225 Auto Lock alock (this);1225 AutoWriteLock alock (this); 1226 1226 CHECK_READY(); 1227 1227 … … 1277 1277 ComAssertRet (aMachine, E_INVALIDARG); 1278 1278 1279 Auto Locklock (this);1279 AutoWriteLock alock (this); 1280 1280 CHECK_READY(); 1281 1281 … … 1296 1296 id.raw()); 1297 1297 1298 Auto Lock devLock (device);1298 AutoWriteLock devLock (device); 1299 1299 1300 1300 if (device->isStatePending()) … … 1319 1319 { 1320 1320 /* Machine::name() requires a read lock */ 1321 AutoRead erLock machLock (device->machine());1321 AutoReadLock machLock (device->machine()); 1322 1322 1323 1323 return setError (E_INVALIDARG, … … 1357 1357 LogFlowThisFunc (("aMachine=%p, aId={%Vuuid}\n", aMachine, Guid (aId).raw())); 1358 1358 1359 Auto Locklock (this);1359 AutoWriteLock alock (this); 1360 1360 CHECK_READY(); 1361 1361 … … 1371 1371 ComAssertRet (!!device, E_FAIL); 1372 1372 1373 Auto Lock devLock (device);1373 AutoWriteLock devLock (device); 1374 1374 1375 1375 LogFlowThisFunc (("id={%Vuuid} state=%d isStatePending=%RTbool pendingState=%d aDone=%RTbool\n", … … 1439 1439 LogFlowThisFunc (("aMachine=%p\n", aMachine)); 1440 1440 1441 Auto Locklock (this);1441 AutoWriteLock alock (this); 1442 1442 CHECK_READY(); 1443 1443 … … 1448 1448 ComObjPtr <HostUSBDevice> device = *it; 1449 1449 1450 Auto Lock devLock (device);1450 AutoWriteLock devLock (device); 1451 1451 1452 1452 /* skip pending devices */ … … 1478 1478 HRESULT Host::detachAllUSBDevices (SessionMachine *aMachine, BOOL aDone) 1479 1479 { 1480 Auto Locklock (this);1480 AutoWriteLock alock (this); 1481 1481 CHECK_READY(); 1482 1482 … … 1486 1486 ComObjPtr <HostUSBDevice> device = *it; 1487 1487 1488 Auto Lock devLock (device);1488 AutoWriteLock devLock (device); 1489 1489 1490 1490 if (device->machine() == aMachine) … … 2023 2023 2024 2024 /// @todo must check for read lock, it's enough here 2025 AssertReturn (is LockedOnCurrentThread(), E_FAIL);2026 2027 AssertReturn (aDevice->is LockedOnCurrentThread(), E_FAIL);2025 AssertReturn (isWriteLockOnCurrentThread(), E_FAIL); 2026 2027 AssertReturn (aDevice->isWriteLockOnCurrentThread(), E_FAIL); 2028 2028 2029 2029 AssertReturn (aDevice->state() != USBDeviceState_Captured, E_FAIL); … … 2049 2049 for (; it != mUSBDeviceFilters.end(); ++ it) 2050 2050 { 2051 Auto Lock filterLock (*it);2051 AutoWriteLock filterLock (*it); 2052 2052 const HostUSBDeviceFilter::Data &data = (*it)->data(); 2053 2053 if (aDevice->isMatch (data)) … … 2119 2119 2120 2120 /// @todo must check for read lock, it's enough here 2121 AssertReturn (is LockedOnCurrentThread(), false);2122 2123 AssertReturn (aDevice->is LockedOnCurrentThread(), false);2121 AssertReturn (isWriteLockOnCurrentThread(), false); 2122 2123 AssertReturn (aDevice->isWriteLockOnCurrentThread(), false); 2124 2124 2125 2125 AssertReturn (aDevice->state() != USBDeviceState_NotSupported, false); … … 2152 2152 AssertReturnVoid (aDevice); 2153 2153 2154 AssertReturnVoid (is LockedOnCurrentThread());2155 AssertReturnVoid (aDevice->is LockedOnCurrentThread());2154 AssertReturnVoid (isWriteLockOnCurrentThread()); 2155 AssertReturnVoid (aDevice->isWriteLockOnCurrentThread()); 2156 2156 2157 2157 LogFlowThisFunc (("id={%Vuuid} state=%d isStatePending=%RTbool pendingState=%d\n", … … 2182 2182 AssertReturnVoid (aDevice); 2183 2183 2184 AssertReturnVoid (is LockedOnCurrentThread());2185 AssertReturnVoid (aDevice->is LockedOnCurrentThread());2184 AssertReturnVoid (isWriteLockOnCurrentThread()); 2185 AssertReturnVoid (aDevice->isWriteLockOnCurrentThread()); 2186 2186 2187 2187 LogFlowThisFunc (("id={%Vuuid} state=%d isStatePending=%RTbool pendingState=%d\n", … … 2226 2226 AssertReturnVoid (aDevice); 2227 2227 2228 AssertReturnVoid (is LockedOnCurrentThread());2229 AssertReturnVoid (aDevice->is LockedOnCurrentThread());2228 AssertReturnVoid (isWriteLockOnCurrentThread()); 2229 AssertReturnVoid (aDevice->isWriteLockOnCurrentThread()); 2230 2230 2231 2231 LogFlowThisFunc (("id={%Vuuid} state=%d isStatePending=%RTbool pendingState=%d\n", … … 2294 2294 { 2295 2295 #ifdef VBOX_WITH_USB 2296 Auto Locklock (this);2296 AutoWriteLock alock (this); 2297 2297 CHECK_READY(); 2298 2298 -
trunk/src/VBox/Main/HostNetworkInterfaceImpl.cpp
r5999 r8083 43 43 ComAssertRet (!guid.isEmpty(), E_INVALIDARG); 44 44 45 Auto Lock lock(this);45 AutoWriteLock alock (this); 46 46 mInterfaceName = interfaceName; 47 47 mGuid = guid; … … 63 63 if (!interfaceName) 64 64 return E_POINTER; 65 Auto Lock lock(this);65 AutoWriteLock alock (this); 66 66 CHECK_READY(); 67 67 mInterfaceName.cloneTo(interfaceName); … … 79 79 if (!guid) 80 80 return E_POINTER; 81 Auto Lock lock(this);81 AutoWriteLock alock (this); 82 82 CHECK_READY(); 83 83 mGuid.cloneTo(guid); -
trunk/src/VBox/Main/KeyboardImpl.cpp
r5999 r8083 82 82 ComAssertRet (parent, E_INVALIDARG); 83 83 84 Auto Lock alock (this);84 AutoWriteLock alock (this); 85 85 ComAssertRet (!isReady(), E_UNEXPECTED); 86 86 … … 99 99 LogFlow(("Keyboard::uninit(): isReady=%d\n", isReady())); 100 100 101 Auto Lock alock (this);101 AutoWriteLock alock (this); 102 102 AssertReturn (isReady(), (void) 0); 103 103 … … 119 119 STDMETHODIMP Keyboard::PutScancode(LONG scancode) 120 120 { 121 Auto Lock alock (this);121 AutoWriteLock alock (this); 122 122 CHECK_READY(); 123 123 … … 151 151 return E_INVALIDARG; 152 152 153 Auto Lock alock (this);153 AutoWriteLock alock (this); 154 154 CHECK_READY(); 155 155 … … 236 236 if (pData->pKeyboard) 237 237 { 238 Auto Lock kbdLock (pData->pKeyboard);238 AutoWriteLock kbdLock (pData->pKeyboard); 239 239 pData->pKeyboard->mpDrv = NULL; 240 240 pData->pKeyboard->mpVMMDev = NULL; -
trunk/src/VBox/Main/MachineDebuggerImpl.cpp
r7990 r8083 70 70 ComAssertRet (parent, E_INVALIDARG); 71 71 72 Auto Lock lock(this);72 AutoWriteLock alock (this); 73 73 ComAssertRet (!isReady(), E_UNEXPECTED); 74 74 … … 94 94 LogFlow(("MachineDebugger::uninit(): isReady=%d\n", isReady())); 95 95 96 Auto Lock lock(this);96 AutoWriteLock alock (this); 97 97 AssertReturn (isReady(), (void) 0); 98 98 … … 110 110 if (!enabled) 111 111 return E_POINTER; 112 Auto Lock lock(this);112 AutoWriteLock alock (this); 113 113 CHECK_READY(); 114 114 /** @todo */ … … 124 124 STDMETHODIMP MachineDebugger::COMSETTER(Singlestep)(BOOL enable) 125 125 { 126 Auto Lock lock(this);126 AutoWriteLock alock (this); 127 127 CHECK_READY(); 128 128 /** @todo */ … … 197 197 if (!enabled) 198 198 return E_POINTER; 199 Auto Lock lock(this);199 AutoWriteLock alock (this); 200 200 CHECK_READY(); 201 201 Console::SafeVMPtrQuiet pVM (mParent); … … 217 217 LogFlowThisFunc (("enable=%d\n", enable)); 218 218 219 Auto Lock lock(this);219 AutoWriteLock alock (this); 220 220 CHECK_READY(); 221 221 … … 264 264 if (!enabled) 265 265 return E_POINTER; 266 Auto Lock lock(this);266 AutoWriteLock alock (this); 267 267 CHECK_READY(); 268 268 Console::SafeVMPtrQuiet pVM (mParent); … … 284 284 LogFlowThisFunc (("enable=%d\n", enable)); 285 285 286 Auto Lock lock(this);286 AutoWriteLock alock (this); 287 287 CHECK_READY(); 288 288 … … 331 331 if (!enabled) 332 332 return E_POINTER; 333 Auto Lock lock(this);333 AutoWriteLock alock (this); 334 334 CHECK_READY(); 335 335 Console::SafeVMPtrQuiet pVM (mParent); … … 349 349 STDMETHODIMP MachineDebugger::COMSETTER(PATMEnabled)(BOOL enable) 350 350 { 351 Auto Lock lock(this);351 AutoWriteLock alock (this); 352 352 CHECK_READY(); 353 353 LogFlowThisFunc (("enable=%d\n", enable)); … … 383 383 if (!enabled) 384 384 return E_POINTER; 385 Auto Lock lock(this);385 AutoWriteLock alock (this); 386 386 CHECK_READY(); 387 387 Console::SafeVMPtrQuiet pVM (mParent); … … 401 401 STDMETHODIMP MachineDebugger::COMSETTER(CSAMEnabled)(BOOL enable) 402 402 { 403 Auto Lock lock(this);403 AutoWriteLock alock (this); 404 404 CHECK_READY(); 405 405 LogFlowThisFunc (("enable=%d\n", enable)); … … 443 443 if (!aEnabled) 444 444 return E_POINTER; 445 Auto Lock alock(this);445 AutoWriteLock alock(this); 446 446 CHECK_READY(); 447 447 PRTLOGGER pLogInstance = RTLogDefaultInstance(); … … 458 458 STDMETHODIMP MachineDebugger::COMSETTER(LogEnabled)(BOOL aEnabled) 459 459 { 460 Auto Lock alock(this);460 AutoWriteLock alock(this); 461 461 462 462 CHECK_READY(); … … 498 498 return E_POINTER; 499 499 500 Auto Lock lock(this);500 AutoWriteLock alock (this); 501 501 CHECK_READY(); 502 502 … … 520 520 return E_POINTER; 521 521 522 Auto Lock lock(this);522 AutoWriteLock alock (this); 523 523 CHECK_READY(); 524 524 … … 545 545 return E_POINTER; 546 546 547 Auto Lock lock(this);547 AutoWriteLock alock (this); 548 548 CHECK_READY(); 549 549 … … 567 567 return E_INVALIDARG; 568 568 569 Auto Lock lock(this);569 AutoWriteLock alock (this); 570 570 CHECK_READY(); 571 571 … … 608 608 return E_POINTER; 609 609 610 Auto Lock lock(this);610 AutoWriteLock alock (this); 611 611 CHECK_READY(); 612 612 -
trunk/src/VBox/Main/MachineImpl.cpp
r8055 r8083 599 599 LogFlowThisFuncEnter(); 600 600 601 Assert (!is LockedOnCurrentThread());601 Assert (!isWriteLockOnCurrentThread()); 602 602 603 603 /* Enclose the state transition Ready->InUninit->NotReady */ … … 703 703 CheckComRCReturnRC (autoCaller.rc()); 704 704 705 Auto Lock alock (this);705 AutoWriteLock alock (this); 706 706 707 707 HRESULT rc = S_OK; … … 734 734 CheckComRCReturnRC (autoCaller.rc()); 735 735 736 AutoRead erLock alock (this);736 AutoReadLock alock (this); 737 737 738 738 if (mData->mAccessible || !mData->mAccessError.isBasicAvailable()) … … 767 767 CheckComRCReturnRC (autoCaller.rc()); 768 768 769 AutoRead erLock alock (this);769 AutoReadLock alock (this); 770 770 771 771 mUserData->mName.cloneTo (aName); … … 786 786 CheckComRCReturnRC (autoCaller.rc()); 787 787 788 Auto Lock alock (this);788 AutoWriteLock alock (this); 789 789 790 790 HRESULT rc = checkStateDependency (MutableStateDep); … … 805 805 CheckComRCReturnRC (autoCaller.rc()); 806 806 807 AutoRead erLock alock (this);807 AutoReadLock alock (this); 808 808 809 809 mUserData->mDescription.cloneTo (aDescription); … … 817 817 CheckComRCReturnRC (autoCaller.rc()); 818 818 819 Auto Lock alock (this);819 AutoWriteLock alock (this); 820 820 821 821 HRESULT rc = checkStateDependency (MutableStateDep); … … 836 836 CheckComRCReturnRC (autoCaller.rc()); 837 837 838 AutoRead erLock alock (this);838 AutoReadLock alock (this); 839 839 840 840 mData->mUuid.cloneTo (aId); … … 851 851 CheckComRCReturnRC (autoCaller.rc()); 852 852 853 AutoRead erLock alock (this);853 AutoReadLock alock (this); 854 854 855 855 mUserData->mOSTypeId.cloneTo (aOSTypeId); … … 872 872 CheckComRCReturnRC (rc); 873 873 874 Auto Lock alock (this);874 AutoWriteLock alock (this); 875 875 876 876 rc = checkStateDependency (MutableStateDep); … … 891 891 CheckComRCReturnRC (autoCaller.rc()); 892 892 893 AutoRead erLock alock (this);893 AutoReadLock alock (this); 894 894 895 895 *memorySize = mHWData->mMemorySize; … … 910 910 CheckComRCReturnRC (autoCaller.rc()); 911 911 912 Auto Lock alock (this);912 AutoWriteLock alock (this); 913 913 914 914 HRESULT rc = checkStateDependency (MutableStateDep); … … 929 929 CheckComRCReturnRC (autoCaller.rc()); 930 930 931 AutoRead erLock alock (this);931 AutoReadLock alock (this); 932 932 933 933 *memorySize = mHWData->mVRAMSize; … … 948 948 CheckComRCReturnRC (autoCaller.rc()); 949 949 950 Auto Lock alock (this);950 AutoWriteLock alock (this); 951 951 952 952 HRESULT rc = checkStateDependency (MutableStateDep); … … 968 968 CheckComRCReturnRC (autoCaller.rc()); 969 969 970 AutoRead erLock alock (this);970 AutoReadLock alock (this); 971 971 972 972 *memoryBalloonSize = mHWData->mMemoryBalloonSize; … … 987 987 CheckComRCReturnRC (autoCaller.rc()); 988 988 989 Auto Lock alock (this);989 AutoWriteLock alock (this); 990 990 991 991 HRESULT rc = checkStateDependency (MutableStateDep); … … 1007 1007 CheckComRCReturnRC (autoCaller.rc()); 1008 1008 1009 AutoRead erLock alock (this);1009 AutoReadLock alock (this); 1010 1010 1011 1011 *statisticsUpdateInterval = mHWData->mStatisticsUpdateInterval; … … 1020 1020 CheckComRCReturnRC (autoCaller.rc()); 1021 1021 1022 Auto Lock alock (this);1022 AutoWriteLock alock (this); 1023 1023 1024 1024 HRESULT rc = checkStateDependency (MutableStateDep); … … 1040 1040 CheckComRCReturnRC (autoCaller.rc()); 1041 1041 1042 AutoRead erLock alock (this);1042 AutoReadLock alock (this); 1043 1043 1044 1044 *monitorCount = mHWData->mMonitorCount; … … 1058 1058 CheckComRCReturnRC (autoCaller.rc()); 1059 1059 1060 Auto Lock alock (this);1060 AutoWriteLock alock (this); 1061 1061 1062 1062 HRESULT rc = checkStateDependency (MutableStateDep); … … 1091 1091 CheckComRCReturnRC (autoCaller.rc()); 1092 1092 1093 AutoRead erLock alock (this);1093 AutoReadLock alock (this); 1094 1094 1095 1095 *enabled = mHWData->mHWVirtExEnabled; … … 1103 1103 CheckComRCReturnRC (autoCaller.rc()); 1104 1104 1105 Auto Lock alock (this);1105 AutoWriteLock alock (this); 1106 1106 1107 1107 HRESULT rc = checkStateDependency (MutableStateDep); … … 1124 1124 CheckComRCReturnRC (autoCaller.rc()); 1125 1125 1126 AutoRead erLock alock (this);1126 AutoReadLock alock (this); 1127 1127 1128 1128 *enabled = mHWData->mPAEEnabled; … … 1136 1136 CheckComRCReturnRC (autoCaller.rc()); 1137 1137 1138 Auto Lock alock (this);1138 AutoWriteLock alock (this); 1139 1139 1140 1140 HRESULT rc = checkStateDependency (MutableStateDep); … … 1157 1157 CheckComRCReturnRC (autoCaller.rc()); 1158 1158 1159 AutoRead erLock alock (this);1159 AutoReadLock alock (this); 1160 1160 1161 1161 mUserData->mSnapshotFolderFull.cloneTo (aSnapshotFolder); … … 1177 1177 CheckComRCReturnRC (autoCaller.rc()); 1178 1178 1179 Auto Lock alock (this);1179 AutoWriteLock alock (this); 1180 1180 1181 1181 HRESULT rc = checkStateDependency (MutableStateDep); … … 1225 1225 CheckComRCReturnRC (autoCaller.rc()); 1226 1226 1227 AutoRead erLock alock (this);1227 AutoReadLock alock (this); 1228 1228 1229 1229 ComObjPtr <HardDiskAttachmentCollection> collection; … … 1244 1244 CheckComRCReturnRC (autoCaller.rc()); 1245 1245 1246 AutoRead erLock alock (this);1246 AutoReadLock alock (this); 1247 1247 1248 1248 Assert (!!mVRDPServer); … … 1263 1263 CheckComRCReturnRC (autoCaller.rc()); 1264 1264 1265 AutoRead erLock alock (this);1265 AutoReadLock alock (this); 1266 1266 1267 1267 Assert (!!mDVDDrive); … … 1278 1278 CheckComRCReturnRC (autoCaller.rc()); 1279 1279 1280 AutoRead erLock alock (this);1280 AutoReadLock alock (this); 1281 1281 1282 1282 Assert (!!mFloppyDrive); … … 1293 1293 CheckComRCReturnRC (autoCaller.rc()); 1294 1294 1295 AutoRead erLock alock (this);1295 AutoReadLock alock (this); 1296 1296 1297 1297 mAudioAdapter.queryInterfaceTo (audioAdapter); … … 1311 1311 CheckComRCReturnRC (rc); 1312 1312 1313 AutoRead erLock alock (this);1313 AutoReadLock alock (this); 1314 1314 1315 1315 return rc = mUSBController.queryInterfaceTo (aUSBController); … … 1331 1331 CheckComRCReturnRC (autoCaller.rc()); 1332 1332 1333 AutoRead erLock alock (this);1333 AutoReadLock alock (this); 1334 1334 1335 1335 return mSATAController.queryInterfaceTo (aSATAController); … … 1350 1350 CheckComRCReturnRC (autoCaller.rc()); 1351 1351 1352 AutoRead erLock alock (this);1352 AutoReadLock alock (this); 1353 1353 1354 1354 mData->mConfigFileFull.cloneTo (aFilePath); … … 1365 1365 CheckComRCReturnRC (autoCaller.rc()); 1366 1366 1367 AutoRead erLock alock (this);1367 AutoReadLock alock (this); 1368 1368 1369 1369 mData->mSettingsFileVersion.cloneTo (aSettingsFileVersion); … … 1379 1379 CheckComRCReturnRC (autoCaller.rc()); 1380 1380 1381 Auto Lock alock (this);1381 AutoWriteLock alock (this); 1382 1382 1383 1383 HRESULT rc = checkStateDependency (MutableStateDep); … … 1408 1408 CheckComRCReturnRC (autoCaller.rc()); 1409 1409 1410 AutoRead erLock alock (this);1410 AutoReadLock alock (this); 1411 1411 1412 1412 *aSessionState = mData->mSession.mState; … … 1423 1423 CheckComRCReturnRC (autoCaller.rc()); 1424 1424 1425 AutoRead erLock alock (this);1425 AutoReadLock alock (this); 1426 1426 1427 1427 mData->mSession.mType.cloneTo (aSessionType); … … 1438 1438 CheckComRCReturnRC (autoCaller.rc()); 1439 1439 1440 AutoRead erLock alock (this);1440 AutoReadLock alock (this); 1441 1441 1442 1442 *aSessionPid = mData->mSession.mPid; … … 1453 1453 CheckComRCReturnRC (autoCaller.rc()); 1454 1454 1455 AutoRead erLock alock (this);1455 AutoReadLock alock (this); 1456 1456 1457 1457 *machineState = mData->mMachineState; … … 1468 1468 CheckComRCReturnRC (autoCaller.rc()); 1469 1469 1470 AutoRead erLock alock (this);1470 AutoReadLock alock (this); 1471 1471 1472 1472 *aLastStateChange = RTTimeSpecGetMilli (&mData->mLastStateChange); … … 1483 1483 CheckComRCReturnRC (autoCaller.rc()); 1484 1484 1485 AutoRead erLock alock (this);1485 AutoReadLock alock (this); 1486 1486 1487 1487 mSSData->mStateFilePath.cloneTo (aStateFilePath); … … 1498 1498 AssertComRCReturnRC (autoCaller.rc()); 1499 1499 1500 AutoRead erLock alock (this);1500 AutoReadLock alock (this); 1501 1501 1502 1502 Utf8Str logFolder; … … 1516 1516 CheckComRCReturnRC (autoCaller.rc()); 1517 1517 1518 AutoRead erLock alock (this);1518 AutoReadLock alock (this); 1519 1519 1520 1520 mData->mCurrentSnapshot.queryInterfaceTo (aCurrentSnapshot); … … 1531 1531 CheckComRCReturnRC (autoCaller.rc()); 1532 1532 1533 AutoRead erLock alock (this);1533 AutoReadLock alock (this); 1534 1534 1535 1535 *aSnapshotCount = !mData->mFirstSnapshot ? 0 : … … 1547 1547 CheckComRCReturnRC (autoCaller.rc()); 1548 1548 1549 AutoRead erLock alock (this);1549 AutoReadLock alock (this); 1550 1550 1551 1551 /* … … 1570 1570 CheckComRCReturnRC (autoCaller.rc()); 1571 1571 1572 AutoRead erLock alock (this);1572 AutoReadLock alock (this); 1573 1573 1574 1574 ComObjPtr <SharedFolderCollection> coll; … … 1589 1589 CheckComRCReturnRC (autoCaller.rc()); 1590 1590 1591 AutoRead erLock alock (this);1591 AutoReadLock alock (this); 1592 1592 1593 1593 *aClipboardMode = mHWData->mClipboardMode; … … 1602 1602 CheckComRCReturnRC (autoCaller.rc()); 1603 1603 1604 Auto Lock alock (this);1604 AutoWriteLock alock (this); 1605 1605 1606 1606 HRESULT rc = checkStateDependency (MutableStateDep); … … 1630 1630 CheckComRCReturnRC (autoCaller.rc()); 1631 1631 1632 Auto Lock alock (this);1632 AutoWriteLock alock (this); 1633 1633 1634 1634 HRESULT rc = checkStateDependency (MutableStateDep); … … 1651 1651 CheckComRCReturnRC (autoCaller.rc()); 1652 1652 1653 AutoRead erLock alock (this);1653 AutoReadLock alock (this); 1654 1654 1655 1655 *aDevice = mHWData->mBootOrder [aPosition - 1]; … … 1693 1693 { 1694 1694 ComObjPtr <HardDisk> hd = hda->hardDisk(); 1695 Auto Lock hdLock (hd);1695 AutoWriteLock hdLock (hd); 1696 1696 return setError (E_FAIL, 1697 1697 tr ("Hard disk '%ls' is already attached to device slot %d on " … … 1712 1712 CheckComRCReturnRC (rc); 1713 1713 1714 Auto Lock hdLock (hd);1714 AutoWriteLock hdLock (hd); 1715 1715 1716 1716 if (hd->isDifferencing()) … … 1839 1839 CheckComRCReturnRC (autoCaller.rc()); 1840 1840 1841 AutoRead erLock alock (this);1841 AutoReadLock alock (this); 1842 1842 1843 1843 *aHardDisk = NULL; … … 1867 1867 CheckComRCReturnRC (autoCaller.rc()); 1868 1868 1869 Auto Lock alock (this);1869 AutoWriteLock alock (this); 1870 1870 1871 1871 HRESULT rc = checkStateDependency (MutableStateDep); … … 1885 1885 { 1886 1886 ComObjPtr <HardDisk> hd = hda->hardDisk(); 1887 Auto Lock hdLock (hd);1887 AutoWriteLock hdLock (hd); 1888 1888 1889 1889 ComAssertRet (hd->children().size() == 0 && … … 1961 1961 CheckComRCReturnRC (autoCaller.rc()); 1962 1962 1963 AutoRead erLock alock (this);1963 AutoReadLock alock (this); 1964 1964 1965 1965 mSerialPorts [slot].queryInterfaceTo (port); … … 1978 1978 CheckComRCReturnRC (autoCaller.rc()); 1979 1979 1980 AutoRead erLock alock (this);1980 AutoReadLock alock (this); 1981 1981 1982 1982 mParallelPorts [slot].queryInterfaceTo (port); … … 1995 1995 CheckComRCReturnRC (autoCaller.rc()); 1996 1996 1997 AutoRead erLock alock (this);1997 AutoReadLock alock (this); 1998 1998 1999 1999 mNetworkAdapters [slot].queryInterfaceTo (adapter); … … 2014 2014 2015 2015 /* serialize file access (prevent writes) */ 2016 AutoRead erLock alock (this);2016 AutoReadLock alock (this); 2017 2017 2018 2018 /* start with nothing found */ … … 2119 2119 2120 2120 /* serialize file access (prevent writes) */ 2121 AutoRead erLock alock (this);2121 AutoReadLock alock (this); 2122 2122 2123 2123 /* start with nothing found */ … … 2348 2348 CheckComRCReturnRC (autoCaller.rc()); 2349 2349 2350 Auto Lock alock (this);2350 AutoWriteLock alock (this); 2351 2351 2352 2352 HRESULT rc = checkStateDependency (MutableStateDep); … … 2367 2367 CheckComRCReturnRC (autoCaller.rc()); 2368 2368 2369 Auto Lock alock (this);2369 AutoWriteLock alock (this); 2370 2370 2371 2371 HRESULT rc = checkStateDependency (MutableStateDep); … … 2442 2442 CheckComRCReturnRC (autoCaller.rc()); 2443 2443 2444 AutoRead erLock alock (this);2444 AutoReadLock alock (this); 2445 2445 2446 2446 Guid id = aId; … … 2463 2463 CheckComRCReturnRC (autoCaller.rc()); 2464 2464 2465 AutoRead erLock alock (this);2465 AutoReadLock alock (this); 2466 2466 2467 2467 ComObjPtr <Snapshot> snapshot; … … 2490 2490 CheckComRCReturnRC (autoCaller.rc()); 2491 2491 2492 Auto Lock alock (this);2492 AutoWriteLock alock (this); 2493 2493 2494 2494 HRESULT rc = checkStateDependency (MutableStateDep); … … 2531 2531 CheckComRCReturnRC (autoCaller.rc()); 2532 2532 2533 Auto Lock alock (this);2533 AutoWriteLock alock (this); 2534 2534 2535 2535 HRESULT rc = checkStateDependency (MutableStateDep); … … 2563 2563 ComPtr <IInternalSessionControl> directControl; 2564 2564 { 2565 AutoRead erLock alock (this);2565 AutoReadLock alock (this); 2566 2566 2567 2567 if (mData->mSession.mState != SessionState_Open) … … 2591 2591 ComPtr <IInternalSessionControl> directControl; 2592 2592 { 2593 AutoRead erLock alock (this);2593 AutoReadLock alock (this); 2594 2594 2595 2595 if (mData->mSession.mState != SessionState_Open) … … 2629 2629 return sm; 2630 2630 2631 AutoRead erLock alock (this);2631 AutoReadLock alock (this); 2632 2632 2633 2633 sm = mData->mSession.mMachine; … … 2652 2652 AssertComRCReturnRC (autoCaller.rc()); 2653 2653 2654 AutoRead erLock alock (this);2654 AutoReadLock alock (this); 2655 2655 2656 2656 /* UUID */ … … 2678 2678 AssertComRCReturn (autoCaller.rc(), autoCaller.rc()); 2679 2679 2680 AutoRead erLock alock (this);2680 AutoReadLock alock (this); 2681 2681 2682 2682 AssertReturn (!mData->mConfigFileFull.isNull(), VERR_GENERAL_FAILURE); … … 2710 2710 AssertComRCReturn (autoCaller.rc(), (void) 0); 2711 2711 2712 AutoRead erLock alock (this);2712 AutoReadLock alock (this); 2713 2713 2714 2714 AssertReturnVoid (!mData->mConfigFileFull.isNull()); … … 2737 2737 AssertComRCReturnVoid (autoCaller.rc()); 2738 2738 2739 AutoRead erLock alock (this);2739 AutoReadLock alock (this); 2740 2740 2741 2741 Utf8Str settingsDir; … … 2772 2772 return false; 2773 2773 2774 AutoRead erLock alock (this);2774 AutoReadLock alock (this); 2775 2775 2776 2776 Machine *m = this; … … 2785 2785 AssertReturn (!dvd.isNull(), false); 2786 2786 2787 AutoRead erLock dvdLock (dvd);2787 AutoReadLock dvdLock (dvd); 2788 2788 2789 2789 /* loop over the backed up (permanent) and current (temporary) DVD data */ … … 2848 2848 return false; 2849 2849 2850 AutoRead erLock alock (this);2850 AutoReadLock alock (this); 2851 2851 2852 2852 Machine *m = this; … … 2861 2861 AssertReturn (!floppy.isNull(), false); 2862 2862 2863 AutoRead erLock floppyLock (floppy);2863 AutoReadLock floppyLock (floppy); 2864 2864 2865 2865 /* loop over the backed up (permanent) and current (temporary) Floppy data */ … … 3114 3114 CheckComRCReturnRC (autoCaller.rc()); 3115 3115 3116 Auto Lock alock (this);3116 AutoWriteLock alock (this); 3117 3117 3118 3118 if (!mData->mRegistered) … … 3334 3334 CheckComRCReturnRC (autoCaller.rc()); 3335 3335 3336 Auto Lock alock (this);3336 AutoWriteLock alock (this); 3337 3337 3338 3338 if (!mData->mRegistered) … … 3421 3421 HRESULT Machine::trySetRegistered (BOOL aRegistered) 3422 3422 { 3423 AssertReturn (mParent->is LockedOnCurrentThread(), E_FAIL);3423 AssertReturn (mParent->isWriteLockOnCurrentThread(), E_FAIL); 3424 3424 3425 3425 AutoLimitedCaller autoCaller (this); 3426 3426 AssertComRCReturnRC (autoCaller.rc()); 3427 3427 3428 Auto Lock alock (this);3428 AutoWriteLock alock (this); 3429 3429 3430 3430 /* wait for state dependants to drop to zero */ … … 3536 3536 AssertComRCReturnRC (autoCaller.rc()); 3537 3537 3538 AutoRead erLock alock (this);3538 AutoReadLock alock (this); 3539 3539 3540 3540 HRESULT rc = checkStateDependency (aDepType); … … 3542 3542 3543 3543 { 3544 Auto Lock stateLock (stateLockHandle());3544 AutoWriteLock stateLock (stateLockHandle()); 3545 3545 3546 3546 if (mData->mMachineStateChangePending != 0) … … 3580 3580 /* stateLockHandle() is the same handle that is used by AutoCaller 3581 3581 * so lock it in advance to avoid two mutex requests in a raw */ 3582 Auto Lock stateLock (stateLockHandle());3582 AutoWriteLock stateLock (stateLockHandle()); 3583 3583 3584 3584 AutoCaller autoCaller (this); … … 3880 3880 * @warning To be used only in methods that change the machine state! 3881 3881 */ 3882 void Machine::ensureNoStateDependencies (Auto Lock &aLock)3882 void Machine::ensureNoStateDependencies (AutoWriteLock &aLock) 3883 3883 { 3884 3884 AssertReturnVoid (aLock.belongsTo (this)); 3885 AssertReturnVoid (aLock.is LockedOnCurrentThread());3886 3887 Auto Lock stateLock (stateLockHandle());3885 AssertReturnVoid (aLock.isWriteLockOnCurrentThread()); 3886 3887 AutoWriteLock stateLock (stateLockHandle()); 3888 3888 3889 3889 /* Wait for all state dependants if necessary */ … … 3928 3928 AssertComRCReturn (autoCaller.rc(), autoCaller.rc()); 3929 3929 3930 Auto Lock alock (this);3930 AutoWriteLock alock (this); 3931 3931 3932 3932 /* wait for state dependants to drop to zero */ … … 3969 3969 ++ it) 3970 3970 { 3971 Auto Lock alock (*it);3971 AutoWriteLock alock (*it); 3972 3972 found = (*it)->name() == aName; 3973 3973 if (found) … … 4569 4569 CheckComRCReturnRC (rc); 4570 4570 4571 Auto Lock hdLock (hd);4571 AutoWriteLock hdLock (hd); 4572 4572 4573 4573 if (!hd->machineId().isEmpty()) … … 4862 4862 * currently differentiate it in callers of saveSettings() so we don't 4863 4863 * make difference here too. */ 4864 AssertReturn (mParent->is LockedOnCurrentThread(), E_FAIL);4865 AssertReturn (is LockedOnCurrentThread(), E_FAIL);4864 AssertReturn (mParent->isWriteLockOnCurrentThread(), E_FAIL); 4865 AssertReturn (isWriteLockOnCurrentThread(), E_FAIL); 4866 4866 4867 4867 HRESULT rc = S_OK; … … 5098 5098 * currently differentiate it in callers of saveSettings() so we don't 5099 5099 * make difference here too. */ 5100 AssertReturn (mParent->is LockedOnCurrentThread(), E_FAIL);5101 AssertReturn (is LockedOnCurrentThread(), E_FAIL);5100 AssertReturn (mParent->isWriteLockOnCurrentThread(), E_FAIL); 5101 AssertReturn (isWriteLockOnCurrentThread(), E_FAIL); 5102 5102 5103 5103 /// @todo (dmik) I guess we should lock all our child objects here … … 5342 5342 /* This object's write lock is also necessary to serialize file access 5343 5343 * (prevent concurrent reads and writes) */ 5344 Auto Lock alock (this);5344 AutoWriteLock alock (this); 5345 5345 5346 5346 AssertReturn (isConfigLocked(), E_FAIL); … … 5405 5405 AssertReturn (!aMachineNode.isNull(), E_FAIL); 5406 5406 5407 AssertReturn (is LockedOnCurrentThread(), E_FAIL);5407 AssertReturn (isWriteLockOnCurrentThread(), E_FAIL); 5408 5408 5409 5409 int op = aOpFlags & SaveSS_OpMask; … … 5623 5623 /* save children */ 5624 5624 { 5625 Auto Lock listLock (aSnapshot->childrenLock());5625 AutoWriteLock listLock (aSnapshot->childrenLock ()); 5626 5626 5627 5627 if (aSnapshot->children().size()) … … 5920 5920 /* This object's write lock is also necessary to serialize file access 5921 5921 * (prevent concurrent reads and writes) */ 5922 Auto Lock alock (this);5922 AutoWriteLock alock (this); 5923 5923 5924 5924 AssertReturn (isConfigLocked(), E_FAIL); … … 5996 5996 AssertComRCReturn (autoCaller.rc(), autoCaller.rc()); 5997 5997 5998 AutoRead erLock alock (this);5998 AutoReadLock alock (this); 5999 5999 6000 6000 AssertReturn (mData->mMachineState == MachineState_PoweredOff || … … 6006 6006 { 6007 6007 ComObjPtr <HardDisk> hd = (*it)->hardDisk(); 6008 Auto Lock hdLock (hd);6008 AutoWriteLock hdLock (hd); 6009 6009 6010 6010 if(hd->isParentImmutable()) … … 6031 6031 AssertComRCReturn (autoCaller.rc(), autoCaller.rc()); 6032 6032 6033 Auto Lock alock (this);6033 AutoWriteLock alock (this); 6034 6034 6035 6035 /* no attac/detach operations -- nothing to do */ … … 6064 6064 ComObjPtr <HardDiskAttachment> hda = *it; 6065 6065 ComObjPtr <HardDisk> hd = hda->hardDisk(); 6066 Auto Lock hdLock (hd);6066 AutoWriteLock hdLock (hd); 6067 6067 6068 6068 if (!hda->isDirty()) … … 6233 6233 while (snap) 6234 6234 { 6235 Auto Lock snapLock (snap);6235 AutoWriteLock snapLock (snap); 6236 6236 6237 6237 const HDData::HDAttachmentList &snapAtts = … … 6279 6279 /* create a new diff for the hard disk being indirectly attached */ 6280 6280 6281 Auto Lock baseHdLock (baseHd);6281 AutoWriteLock baseHdLock (baseHd); 6282 6282 baseHd->addReader(); 6283 6283 … … 6328 6328 ComObjPtr <HardDiskAttachment> hda = *it; 6329 6329 ComObjPtr <HardDisk> hd = hda->hardDisk(); 6330 Auto Lock hdLock (hd);6330 AutoWriteLock hdLock (hd); 6331 6331 6332 6332 if (hd->isDifferencing()) … … 6371 6371 ComObjPtr <HardDiskAttachment> hda = *it; 6372 6372 ComObjPtr <HardDisk> hd = hda->hardDisk(); 6373 Auto Lock hdLock (hd);6373 AutoWriteLock hdLock (hd); 6374 6374 6375 6375 if (hda->isDirty()) … … 6463 6463 ComObjPtr <HardDiskAttachment> hda = *it; 6464 6464 ComObjPtr <HardDisk> hd = hda->hardDisk(); 6465 Auto Lock hdLock (hd);6465 AutoWriteLock hdLock (hd); 6466 6466 6467 6467 ComAssertMsgBreak (hd->type() == HardDiskType_Normal, … … 6498 6498 ComObjPtr <HardDiskAttachment> hda = *it; 6499 6499 ComObjPtr <HardDisk> hd = hda->hardDisk(); 6500 Auto Lock hdLock (hd);6500 AutoWriteLock hdLock (hd); 6501 6501 6502 6502 ComObjPtr <HardDisk> parent = hd->parent(); 6503 Auto Lock parentHdLock (parent);6503 AutoWriteLock parentHdLock (parent); 6504 6504 6505 6505 ComObjPtr <HardDisk> newHd; … … 6609 6609 { 6610 6610 ComObjPtr <HardDisk> hd = (*it)->hardDisk(); 6611 Auto Lock hdLock (hd);6611 AutoWriteLock hdLock (hd); 6612 6612 Assert (hd->children().size() == 0); 6613 6613 Assert (hd->isDifferencing()); … … 6651 6651 ComObjPtr <HardDiskAttachment> hda = *it; 6652 6652 ComObjPtr <HardDisk> hd = hda->hardDisk(); 6653 Auto Lock hdLock (hd);6653 AutoWriteLock hdLock (hd); 6654 6654 6655 6655 ComObjPtr <HardDisk> parent = hd->parent(); 6656 Auto Lock parentHdLock (parent);6656 AutoWriteLock parentHdLock (parent); 6657 6657 6658 6658 if (!parent || parent->snapshotId() != aSnapshot->data().mId) … … 6766 6766 AssertComRCReturn (autoCaller.rc(), false); 6767 6767 6768 AutoRead erLock alock (this);6768 AutoReadLock alock (this); 6769 6769 6770 6770 for (ULONG slot = 0; slot < ELEMENTS (mNetworkAdapters); slot ++) … … 6808 6808 AssertComRCReturn (autoCaller.rc(), false); 6809 6809 6810 AutoRead erLock alock (this);6810 AutoReadLock alock (this); 6811 6811 6812 6812 for (ULONG slot = 0; slot < ELEMENTS (mNetworkAdapters); slot ++) … … 6850 6850 AssertComRCReturn (autoCaller.rc(), (void) 0); 6851 6851 6852 Auto Lock alock (this);6852 AutoWriteLock alock (this); 6853 6853 6854 6854 /* check for changes in own data */ … … 6988 6988 AssertComRCReturn (autoCaller.rc(), autoCaller.rc()); 6989 6989 6990 Auto Lock alock (this);6990 AutoWriteLock alock (this); 6991 6991 6992 6992 HRESULT rc = S_OK; … … 7193 7193 AssertReturn (aMachine, E_INVALIDARG); 7194 7194 7195 AssertReturn (aMachine->lockHandle()->is LockedOnCurrentThread(), E_FAIL);7195 AssertReturn (aMachine->lockHandle()->isWriteLockOnCurrentThread(), E_FAIL); 7196 7196 7197 7197 /* Enclose the state transition NotReady->InInit->Ready */ … … 7527 7527 } 7528 7528 7529 // AutoLock::Lockable interface7529 // util::Lockable interface 7530 7530 //////////////////////////////////////////////////////////////////////////////// 7531 7531 … … 7559 7559 AssertComRCReturn (autoCaller.rc(), autoCaller.rc()); 7560 7560 7561 AutoRead erLock alock (this);7561 AutoReadLock alock (this); 7562 7562 7563 7563 #if defined(RT_OS_WINDOWS) || defined(RT_OS_OS2) … … 7863 7863 AssertComRCReturn (autoCaller.rc(), autoCaller.rc()); 7864 7864 7865 Auto Lock alock (this);7865 AutoWriteLock alock (this); 7866 7866 7867 7867 AssertReturn (mData->mMachineState == MachineState_PoweredOff || … … 7932 7932 { 7933 7933 ComObjPtr <HardDisk> hd = (*it)->hardDisk(); 7934 Auto Lock hdLock (hd);7934 AutoWriteLock hdLock (hd); 7935 7935 if (hd->type() == HardDiskType_Writethrough) 7936 7936 return setError (E_FAIL, … … 8108 8108 CheckComRCReturnRC (rc); 8109 8109 8110 Auto Lock snapshotLock (snapshot);8110 AutoWriteLock snapshotLock (snapshot); 8111 8111 if (snapshot == mData->mFirstSnapshot) 8112 8112 { 8113 Auto Lock chLock (mData->mFirstSnapshot->childrenLock());8113 AutoWriteLock chLock (mData->mFirstSnapshot->childrenLock ()); 8114 8114 size_t childrenCount = mData->mFirstSnapshot->children().size(); 8115 8115 if (childrenCount > 1) … … 8356 8356 } 8357 8357 8358 Auto Lock alock (this);8358 AutoWriteLock alock (this); 8359 8359 8360 8360 /* … … 8430 8430 ComPtr <IInternalSessionControl> directControl; 8431 8431 { 8432 AutoRead erLock alock (this);8432 AutoReadLock alock (this); 8433 8433 directControl = mData->mSession.mDirectControl; 8434 8434 } … … 8453 8453 ComPtr <IInternalSessionControl> directControl; 8454 8454 { 8455 AutoRead erLock alock (this);8455 AutoReadLock alock (this); 8456 8456 directControl = mData->mSession.mDirectControl; 8457 8457 } … … 8476 8476 ComPtr <IInternalSessionControl> directControl; 8477 8477 { 8478 AutoRead erLock alock (this);8478 AutoReadLock alock (this); 8479 8479 directControl = mData->mSession.mDirectControl; 8480 8480 } … … 8499 8499 ComPtr <IInternalSessionControl> directControl; 8500 8500 { 8501 AutoRead erLock alock (this);8501 AutoReadLock alock (this); 8502 8502 directControl = mData->mSession.mDirectControl; 8503 8503 } … … 8522 8522 ComPtr <IInternalSessionControl> directControl; 8523 8523 { 8524 AutoRead erLock alock (this);8524 AutoReadLock alock (this); 8525 8525 directControl = mData->mSession.mDirectControl; 8526 8526 } … … 8545 8545 ComPtr <IInternalSessionControl> directControl; 8546 8546 { 8547 AutoRead erLock alock (this);8547 AutoReadLock alock (this); 8548 8548 directControl = mData->mSession.mDirectControl; 8549 8549 } … … 8568 8568 ComPtr <IInternalSessionControl> directControl; 8569 8569 { 8570 AutoRead erLock alock (this);8570 AutoReadLock alock (this); 8571 8571 directControl = mData->mSession.mDirectControl; 8572 8572 } … … 8591 8591 ComPtr <IInternalSessionControl> directControl; 8592 8592 { 8593 AutoRead erLock alock (this);8593 AutoReadLock alock (this); 8594 8594 directControl = mData->mSession.mDirectControl; 8595 8595 } … … 8616 8616 return false; 8617 8617 8618 AutoRead erLock alock (this);8618 AutoReadLock alock (this); 8619 8619 8620 8620 #ifdef VBOX_WITH_USB … … 8642 8642 ComPtr <IInternalSessionControl> directControl; 8643 8643 { 8644 AutoRead erLock alock (this);8644 AutoReadLock alock (this); 8645 8645 directControl = mData->mSession.mDirectControl; 8646 8646 } … … 8670 8670 ComPtr <IInternalSessionControl> directControl; 8671 8671 { 8672 AutoRead erLock alock (this);8672 AutoReadLock alock (this); 8673 8673 directControl = mData->mSession.mDirectControl; 8674 8674 } … … 8973 8973 ComObjPtr <HardDisk> parent = hd->parent(); 8974 8974 8975 Auto Lock hdLock (hd);8975 AutoWriteLock hdLock (hd); 8976 8976 8977 8977 if (hd->hasForeignChildren()) … … 8986 8986 if (hd->type() == HardDiskType_Normal) 8987 8987 { 8988 Auto Lock hdChildrenLock (hd->childrenLock());8988 AutoWriteLock hdChildrenLock (hd->childrenLock ()); 8989 8989 size_t childrenCount = hd->children().size(); 8990 8990 if (childrenCount > 1) … … 9041 9041 ComObjPtr <HardDisk> parent = hd->parent(); 9042 9042 9043 Auto Lock hdLock (hd);9043 AutoWriteLock hdLock (hd); 9044 9044 9045 9045 Bstr hdRootString = hd->root()->toString (true /* aShort */); … … 9105 9105 ComObjPtr <HardDisk> child; 9106 9106 { 9107 Auto Lock hdChildrenLock (hd->childrenLock());9107 AutoWriteLock hdChildrenLock (hd->childrenLock ()); 9108 9108 if (hd->children().size()) 9109 9109 child = hd->children().front(); … … 9125 9125 else 9126 9126 { 9127 Auto Lock childLock (child);9127 AutoWriteLock childLock (child); 9128 9128 9129 9129 aTask.progress->advanceOperation (Bstr (Utf8StrFmt ( … … 9395 9395 { 9396 9396 ComObjPtr <Snapshot> curSnapshot = mData->mCurrentSnapshot; 9397 Auto Lock snapshotLock (curSnapshot);9397 AutoWriteLock snapshotLock (curSnapshot); 9398 9398 9399 9399 /* remember the timestamp of the snapshot we're restoring from */ … … 9592 9592 AssertComRCReturn (autoCaller.rc(), autoCaller.rc()); 9593 9593 9594 Auto Lock alock (this);9594 AutoWriteLock alock (this); 9595 9595 9596 9596 MachineState_T oldMachineState = mData->mMachineState; … … 9621 9621 { 9622 9622 ComObjPtr <HardDisk> hd = (*it)->hardDisk(); 9623 Auto Lock hdLock (hd);9623 AutoWriteLock hdLock (hd); 9624 9624 hd->setBusy(); 9625 9625 hd->addReaderOnAncestors(); … … 9641 9641 { 9642 9642 ComObjPtr <HardDisk> hd = (*it)->hardDisk(); 9643 Auto Lock hdLock (hd);9643 AutoWriteLock hdLock (hd); 9644 9644 hd->releaseReaderOnAncestors(); 9645 9645 hd->clearBusy(); … … 9762 9762 ComPtr <IInternalSessionControl> directControl; 9763 9763 { 9764 AutoRead erLock alock (this);9764 AutoReadLock alock (this); 9765 9765 AssertReturn (!!mData, E_FAIL); 9766 9766 directControl = mData->mSession.mDirectControl; … … 9844 9844 AssertReturn (autoInitSpan.isOk(), E_UNEXPECTED); 9845 9845 9846 AssertReturn (aSessionMachine->is LockedOnCurrentThread(), E_FAIL);9846 AssertReturn (aSessionMachine->isWriteLockOnCurrentThread(), E_FAIL); 9847 9847 9848 9848 mSnapshotId = aSnapshotId; … … 10071 10071 } 10072 10072 10073 // AutoLock::Lockable interface10073 // util::Lockable interface 10074 10074 //////////////////////////////////////////////////////////////////////////////// 10075 10075 … … 10095 10095 HRESULT SnapshotMachine::onSnapshotChange (Snapshot *aSnapshot) 10096 10096 { 10097 Auto Lock alock (this);10097 AutoWriteLock alock (this); 10098 10098 10099 10099 mPeer->saveSnapshotSettings (aSnapshot, SaveSS_UpdateAttrsOp); -
trunk/src/VBox/Main/MouseImpl.cpp
r5999 r8083 76 76 ComAssertRet (parent, E_INVALIDARG); 77 77 78 Auto Lock alock (this);78 AutoWriteLock alock (this); 79 79 ComAssertRet (!isReady(), E_UNEXPECTED); 80 80 … … 100 100 LogFlow(("Mouse::uninit(): isReady=%d\n", isReady())); 101 101 102 Auto Lock alock (this);102 AutoWriteLock alock (this); 103 103 AssertReturn (isReady(), (void) 0); 104 104 … … 125 125 return E_POINTER; 126 126 127 Auto Lock alock (this);127 AutoWriteLock alock (this); 128 128 CHECK_READY(); 129 129 … … 152 152 return E_POINTER; 153 153 154 Auto Lock alock (this);154 AutoWriteLock alock (this); 155 155 CHECK_READY(); 156 156 … … 181 181 STDMETHODIMP Mouse::PutMouseEvent(LONG dx, LONG dy, LONG dz, LONG buttonState) 182 182 { 183 Auto Lock alock (this);183 AutoWriteLock alock (this); 184 184 CHECK_READY(); 185 185 … … 234 234 LONG buttonState) 235 235 { 236 Auto Lock alock (this);236 AutoWriteLock alock (this); 237 237 CHECK_READY(); 238 238 … … 340 340 if (pData->pMouse) 341 341 { 342 Auto Lock mouseLock (pData->pMouse);342 AutoWriteLock mouseLock (pData->pMouse); 343 343 pData->pMouse->mpDrv = NULL; 344 344 } -
trunk/src/VBox/Main/NetworkAdapterImpl.cpp
r7992 r8083 107 107 AssertComRCReturnRC (thatCaller.rc()); 108 108 109 AutoRead erLock thatLock (aThat);109 AutoReadLock thatLock (aThat); 110 110 mData.share (aThat->mData); 111 111 … … 139 139 AssertComRCReturnRC (thatCaller.rc()); 140 140 141 AutoRead erLock thatLock (aThat);141 AutoReadLock thatLock (aThat); 142 142 mData.attachCopy (aThat->mData); 143 143 … … 178 178 CheckComRCReturnRC (autoCaller.rc()); 179 179 180 AutoRead erLock alock (this);180 AutoReadLock alock (this); 181 181 182 182 *aAdapterType = mData->mAdapterType; … … 194 194 CheckComRCReturnRC (adep.rc()); 195 195 196 Auto Lock alock (this);196 AutoWriteLock alock (this); 197 197 198 198 /* make sure the value is allowed */ … … 233 233 CheckComRCReturnRC (autoCaller.rc()); 234 234 235 AutoRead erLock alock (this);235 AutoReadLock alock (this); 236 236 237 237 *aSlot = mData->mSlot; … … 248 248 CheckComRCReturnRC (autoCaller.rc()); 249 249 250 AutoRead erLock alock (this);250 AutoReadLock alock (this); 251 251 252 252 *aEnabled = mData->mEnabled; … … 264 264 CheckComRCReturnRC (adep.rc()); 265 265 266 Auto Lock alock (this);266 AutoWriteLock alock (this); 267 267 268 268 if (mData->mEnabled != aEnabled) … … 288 288 CheckComRCReturnRC (autoCaller.rc()); 289 289 290 AutoRead erLock alock (this);290 AutoReadLock alock (this); 291 291 292 292 ComAssertRet (!!mData->mMACAddress, E_FAIL); … … 306 306 CheckComRCReturnRC (adep.rc()); 307 307 308 Auto Lock alock (this);308 AutoWriteLock alock (this); 309 309 310 310 HRESULT rc = S_OK; … … 386 386 CheckComRCReturnRC (autoCaller.rc()); 387 387 388 AutoRead erLock alock (this);388 AutoReadLock alock (this); 389 389 390 390 *aAttachmentType = mData->mAttachmentType; … … 401 401 CheckComRCReturnRC (autoCaller.rc()); 402 402 403 AutoRead erLock alock (this);403 AutoReadLock alock (this); 404 404 405 405 mData->mHostInterface.cloneTo (aHostInterface); … … 432 432 CheckComRCReturnRC (adep.rc()); 433 433 434 Auto Lock alock (this);434 AutoWriteLock alock (this); 435 435 436 436 if (mData->mHostInterface != aHostInterface) … … 458 458 CheckComRCReturnRC (autoCaller.rc()); 459 459 460 AutoRead erLock alock (this);460 AutoReadLock alock (this); 461 461 462 462 *aTAPFileDescriptor = mData->mTAPFD; … … 485 485 CheckComRCReturnRC (adep.rc()); 486 486 487 Auto Lock alock (this);487 AutoWriteLock alock (this); 488 488 489 489 if (mData->mTAPFD != (RTFILE) aTAPFileDescriptor) … … 510 510 CheckComRCReturnRC (autoCaller.rc()); 511 511 512 AutoRead erLock alock (this);512 AutoReadLock alock (this); 513 513 514 514 /* we don't have to be in TAP mode to support this call */ … … 532 532 CheckComRCReturnRC (adep.rc()); 533 533 534 Auto Lock alock (this);534 AutoWriteLock alock (this); 535 535 536 536 if (mData->mTAPSetupApplication != aTAPSetupApplication) … … 557 557 CheckComRCReturnRC (autoCaller.rc()); 558 558 559 AutoRead erLock alock (this);559 AutoReadLock alock (this); 560 560 561 561 /* we don't have to be in TAP mode to support this call */ … … 579 579 CheckComRCReturnRC (adep.rc()); 580 580 581 Auto Lock alock (this);581 AutoWriteLock alock (this); 582 582 583 583 if (mData->mTAPTerminateApplication != aTAPTerminateApplication) … … 606 606 CheckComRCReturnRC (autoCaller.rc()); 607 607 608 AutoRead erLock alock (this);608 AutoReadLock alock (this); 609 609 610 610 mData->mInternalNetwork.cloneTo (aInternalNetwork); … … 625 625 CheckComRCReturnRC (adep.rc()); 626 626 627 Auto Lock alock (this);627 AutoWriteLock alock (this); 628 628 629 629 if (mData->mInternalNetwork != aInternalNetwork) … … 656 656 CheckComRCReturnRC (autoCaller.rc()); 657 657 658 AutoRead erLock alock (this);658 AutoReadLock alock (this); 659 659 660 660 *aConnected = mData->mCableConnected; … … 672 672 CheckComRCReturnRC (adep.rc()); 673 673 674 Auto Lock alock (this);674 AutoWriteLock alock (this); 675 675 676 676 if (aConnected != mData->mCableConnected) … … 696 696 CheckComRCReturnRC (autoCaller.rc()); 697 697 698 AutoRead erLock alock (this);698 AutoReadLock alock (this); 699 699 700 700 *aSpeed = mData->mLineSpeed; … … 712 712 CheckComRCReturnRC (adep.rc()); 713 713 714 Auto Lock alock (this);714 AutoWriteLock alock (this); 715 715 716 716 if (aSpeed != mData->mLineSpeed) … … 736 736 CheckComRCReturnRC (autoCaller.rc()); 737 737 738 AutoRead erLock alock (this);738 AutoReadLock alock (this); 739 739 740 740 *aEnabled = mData->mTraceEnabled; … … 751 751 CheckComRCReturnRC (adep.rc()); 752 752 753 Auto Lock alock (this);753 AutoWriteLock alock (this); 754 754 755 755 if (aEnabled != mData->mTraceEnabled) … … 775 775 CheckComRCReturnRC (autoCaller.rc()); 776 776 777 AutoRead erLock alock (this);777 AutoReadLock alock (this); 778 778 779 779 mData->mTraceFile.cloneTo (aTraceFile); … … 791 791 CheckComRCReturnRC (adep.rc()); 792 792 793 Auto Lock alock (this);793 AutoWriteLock alock (this); 794 794 795 795 if (mData->mTraceFile != aTraceFile) … … 819 819 CheckComRCReturnRC (adep.rc()); 820 820 821 Auto Lock alock (this);821 AutoWriteLock alock (this); 822 822 823 823 if (mData->mAttachmentType != NetworkAttachmentType_NAT) … … 847 847 CheckComRCReturnRC (adep.rc()); 848 848 849 Auto Lock alock (this);849 AutoWriteLock alock (this); 850 850 851 851 /* don't do anything if we're already host interface attached */ … … 877 877 CheckComRCReturnRC (adep.rc()); 878 878 879 Auto Lock alock (this);879 AutoWriteLock alock (this); 880 880 881 881 /* don't do anything if we're already internal network attached */ … … 916 916 CheckComRCReturnRC (adep.rc()); 917 917 918 Auto Lock alock (this);918 AutoWriteLock alock (this); 919 919 920 920 if (mData->mAttachmentType != NetworkAttachmentType_Null) … … 953 953 AssertComRCReturnRC (autoCaller.rc()); 954 954 955 Auto Lock alock (this);955 AutoWriteLock alock (this); 956 956 957 957 /* Note: we assume that the default values for attributes of optional … … 1065 1065 AssertComRCReturnRC (autoCaller.rc()); 1066 1066 1067 AutoRead erLock alock (this);1067 AutoReadLock alock (this); 1068 1068 1069 1069 aAdapterNode.setValue <bool> ("enabled", !!mData->mEnabled); … … 1154 1154 AssertComRCReturn (autoCaller.rc(), false); 1155 1155 1156 Auto Lock alock (this);1156 AutoWriteLock alock (this); 1157 1157 1158 1158 bool changed = false; … … 1232 1232 void NetworkAdapter::detach() 1233 1233 { 1234 AssertReturnVoid (is LockedOnCurrentThread());1234 AssertReturnVoid (isWriteLockOnCurrentThread()); 1235 1235 1236 1236 switch (mData->mAttachmentType) -
trunk/src/VBox/Main/ParallelPortImpl.cpp
r7992 r8083 97 97 AssertComRCReturnRC (thatCaller.rc()); 98 98 99 AutoRead erLock thatLock (aThat);99 AutoReadLock thatLock (aThat); 100 100 mData.share (aThat->mData); 101 101 … … 129 129 AssertComRCReturnRC (thatCaller.rc()); 130 130 131 AutoRead erLock thatLock (aThat);131 AutoReadLock thatLock (aThat); 132 132 mData.attachCopy (aThat->mData); 133 133 … … 177 177 AssertComRCReturnRC (autoCaller.rc()); 178 178 179 Auto Lock alock (this);179 AutoWriteLock alock (this); 180 180 181 181 /* Note: we assume that the default values for attributes of optional … … 224 224 AssertComRCReturnRC (autoCaller.rc()); 225 225 226 AutoRead erLock alock (this);226 AutoReadLock alock (this); 227 227 228 228 aPortNode.setValue <bool> ("enabled", !!mData->mEnabled); … … 246 246 AssertComRCReturn (autoCaller.rc(), false); 247 247 248 Auto Lock alock (this);248 AutoWriteLock alock (this); 249 249 250 250 bool changed = false; … … 325 325 CheckComRCReturnRC (autoCaller.rc()); 326 326 327 AutoRead erLock alock (this);327 AutoReadLock alock (this); 328 328 329 329 *aEnabled = mData->mEnabled; … … 343 343 CheckComRCReturnRC (adep.rc()); 344 344 345 Auto Lock alock (this);345 AutoWriteLock alock (this); 346 346 347 347 if (mData->mEnabled != aEnabled) … … 374 374 CheckComRCReturnRC (autoCaller.rc()); 375 375 376 AutoRead erLock alock (this);376 AutoReadLock alock (this); 377 377 378 378 *aSlot = mData->mSlot; … … 389 389 CheckComRCReturnRC (autoCaller.rc()); 390 390 391 AutoRead erLock alock (this);391 AutoReadLock alock (this); 392 392 393 393 *aIRQ = mData->mIRQ; … … 413 413 CheckComRCReturnRC (adep.rc()); 414 414 415 Auto Lock alock (this);415 AutoWriteLock alock (this); 416 416 417 417 HRESULT rc = S_OK; … … 444 444 CheckComRCReturnRC (autoCaller.rc()); 445 445 446 AutoRead erLock alock (this);446 AutoReadLock alock (this); 447 447 448 448 *aIOBase = mData->mIOBase; … … 468 468 CheckComRCReturnRC (adep.rc()); 469 469 470 Auto Lock alock (this);470 AutoWriteLock alock (this); 471 471 472 472 HRESULT rc = S_OK; … … 499 499 CheckComRCReturnRC (autoCaller.rc()); 500 500 501 AutoRead erLock alock (this);501 AutoReadLock alock (this); 502 502 503 503 mData->mPath.cloneTo (aPath); … … 511 511 HRESULT ParallelPort::checkSetPath (const BSTR aPath) 512 512 { 513 AssertReturn (is LockedOnCurrentThread(), E_FAIL);513 AssertReturn (isWriteLockOnCurrentThread(), E_FAIL); 514 514 515 515 if (mData->mEnabled && … … 532 532 CheckComRCReturnRC (adep.rc()); 533 533 534 Auto Lock alock (this);534 AutoWriteLock alock (this); 535 535 536 536 if (mData->mPath != aPath) -
trunk/src/VBox/Main/ProgressImpl.cpp
r7992 r8083 158 158 * Using mParent member after this method returns is forbidden. 159 159 */ 160 void ProgressBase::protectedUninit (Auto Lock &alock)160 void ProgressBase::protectedUninit (AutoWriteLock &alock) 161 161 { 162 162 LogFlowMember (("ProgressBase::protectedUninit()\n")); 163 163 164 Assert (alock.belongsTo (this) && alock.is LockedOnCurrentThread() &&164 Assert (alock.belongsTo (this) && alock.isWriteLockOnCurrentThread() && 165 165 alock.writeLockLevel() == 1); 166 166 Assert (isReady()); … … 194 194 return E_POINTER; 195 195 196 Auto Locklock (this);196 AutoWriteLock alock (this); 197 197 CHECK_READY(); 198 198 … … 208 208 return E_POINTER; 209 209 210 Auto Locklock (this);210 AutoWriteLock alock (this); 211 211 CHECK_READY(); 212 212 … … 222 222 return E_POINTER; 223 223 224 Auto Lock lock(this);224 AutoWriteLock alock (this); 225 225 CHECK_READY(); 226 226 … … 246 246 return E_POINTER; 247 247 248 Auto Lock lock(this);248 AutoWriteLock alock (this); 249 249 CHECK_READY(); 250 250 … … 258 258 return E_POINTER; 259 259 260 Auto Lock lock(this);260 AutoWriteLock alock (this); 261 261 CHECK_READY(); 262 262 … … 278 278 return E_POINTER; 279 279 280 Auto Lock lock(this);280 AutoWriteLock alock (this); 281 281 CHECK_READY(); 282 282 … … 290 290 return E_POINTER; 291 291 292 Auto Lock lock(this);292 AutoWriteLock alock (this); 293 293 CHECK_READY(); 294 294 … … 302 302 return E_POINTER; 303 303 304 Auto Lock lock(this);304 AutoWriteLock alock (this); 305 305 CHECK_READY(); 306 306 … … 318 318 return E_POINTER; 319 319 320 Auto Lock lock(this);320 AutoWriteLock alock (this); 321 321 CHECK_READY(); 322 322 … … 334 334 return E_POINTER; 335 335 336 Auto Lock lock(this);336 AutoWriteLock alock (this); 337 337 CHECK_READY(); 338 338 … … 346 346 return E_POINTER; 347 347 348 Auto Lock lock(this);348 AutoWriteLock alock (this); 349 349 CHECK_READY(); 350 350 … … 358 358 return E_POINTER; 359 359 360 Auto Lock lock(this);360 AutoWriteLock alock (this); 361 361 CHECK_READY(); 362 362 … … 370 370 return E_POINTER; 371 371 372 Auto Lock lock(this);372 AutoWriteLock alock (this); 373 373 CHECK_READY(); 374 374 … … 429 429 ComAssertRet (aOperationCount >= 1, E_INVALIDARG); 430 430 431 Auto Lock lock(this);431 AutoWriteLock alock (this); 432 432 ComAssertRet (!isReady(), E_UNEXPECTED); 433 433 … … 470 470 LogFlowMember(("Progress::init(): <undescriptioned>\n")); 471 471 472 Auto Lock lock(this);472 AutoWriteLock alock (this); 473 473 ComAssertRet (!isReady(), E_UNEXPECTED); 474 474 … … 510 510 LogFlowMember (("Progress::uninit()\n")); 511 511 512 Auto Lock alock (this);512 AutoWriteLock alock (this); 513 513 514 514 LogFlowMember (("Progress::uninit(): isReady=%d\n", isReady())); … … 547 547 LogFlowMember(("Progress::WaitForCompletion: BEGIN: timeout=%d\n", aTimeout)); 548 548 549 Auto Lock lock(this);549 AutoWriteLock alock (this); 550 550 CHECK_READY(); 551 551 … … 564 564 { 565 565 mWaitersCount ++; 566 lock.unlock();566 alock.unlock(); 567 567 int vrc = RTSemEventMultiWait (mCompletedSem, 568 568 forever ? RT_INDEFINITE_WAIT 569 569 : (unsigned) timeLeft); 570 lock.lock();570 alock.lock(); 571 571 mWaitersCount --; 572 572 … … 611 611 "operation=%d, timeout=%d\n", aOperation, aTimeout)); 612 612 613 Auto Lock lock(this);613 AutoWriteLock alock (this); 614 614 CHECK_READY(); 615 615 … … 634 634 { 635 635 mWaitersCount ++; 636 lock.unlock();636 alock.unlock(); 637 637 int vrc = RTSemEventMultiWait (mCompletedSem, 638 638 forever ? RT_INDEFINITE_WAIT 639 639 : (unsigned) timeLeft); 640 lock.lock();640 alock.lock(); 641 641 mWaitersCount --; 642 642 … … 671 671 STDMETHODIMP Progress::Cancel() 672 672 { 673 Auto Lock lock(this);673 AutoWriteLock alock (this); 674 674 CHECK_READY(); 675 675 … … 697 697 HRESULT Progress::notifyProgress (LONG aPercent) 698 698 { 699 Auto Locklock (this);699 AutoWriteLock alock (this); 700 700 AssertReturn (isReady(), E_UNEXPECTED); 701 701 … … 721 721 AssertReturn (aOperationDescription, E_INVALIDARG); 722 722 723 Auto Locklock (this);723 AutoWriteLock alock (this); 724 724 AssertReturn (isReady(), E_UNEXPECTED); 725 725 … … 756 756 HRESULT Progress::notifyComplete (HRESULT aResultCode) 757 757 { 758 Auto Locklock (this);758 AutoWriteLock alock (this); 759 759 AssertReturn (isReady(), E_FAIL); 760 760 … … 865 865 const Bstr &aComponent, const Bstr &aText) 866 866 { 867 Auto Locklock (this);867 AutoWriteLock alock (this); 868 868 AssertReturn (isReady(), E_UNEXPECTED); 869 869 … … 1006 1006 LogFlowMember (("CombinedProgress::uninit()\n")); 1007 1007 1008 Auto Lock alock (this);1008 AutoWriteLock alock (this); 1009 1009 1010 1010 LogFlowMember (("CombinedProgress::uninit(): isReady=%d\n", isReady())); … … 1027 1027 return E_POINTER; 1028 1028 1029 Auto Lock lock(this);1029 AutoWriteLock alock (this); 1030 1030 CHECK_READY(); 1031 1031 … … 1051 1051 return E_POINTER; 1052 1052 1053 Auto Lock lock(this);1053 AutoWriteLock alock (this); 1054 1054 CHECK_READY(); 1055 1055 … … 1066 1066 return E_POINTER; 1067 1067 1068 Auto Lock lock(this);1068 AutoWriteLock alock (this); 1069 1069 CHECK_READY(); 1070 1070 … … 1081 1081 return E_POINTER; 1082 1082 1083 Auto Lock lock(this);1083 AutoWriteLock alock (this); 1084 1084 CHECK_READY(); 1085 1085 … … 1096 1096 return E_POINTER; 1097 1097 1098 Auto Lock lock(this);1098 AutoWriteLock alock (this); 1099 1099 CHECK_READY(); 1100 1100 … … 1111 1111 return E_POINTER; 1112 1112 1113 Auto Lock lock(this);1113 AutoWriteLock alock (this); 1114 1114 CHECK_READY(); 1115 1115 … … 1126 1126 return E_POINTER; 1127 1127 1128 Auto Lock lock(this);1128 AutoWriteLock alock (this); 1129 1129 CHECK_READY(); 1130 1130 … … 1141 1141 return E_POINTER; 1142 1142 1143 Auto Lock lock(this);1143 AutoWriteLock alock (this); 1144 1144 CHECK_READY(); 1145 1145 … … 1166 1166 aTimeout)); 1167 1167 1168 Auto Locklock (this);1168 AutoWriteLock alock (this); 1169 1169 CHECK_READY(); 1170 1170 … … 1182 1182 while (!mCompleted && (forever || timeLeft > 0)) 1183 1183 { 1184 lock.unlock();1184 alock.unlock(); 1185 1185 rc = mProgresses.back()->WaitForCompletion ( 1186 1186 forever ? -1 : (LONG) timeLeft); 1187 lock.lock();1187 alock.lock(); 1188 1188 1189 1189 // the progress might have been uninitialized … … 1225 1225 "operation=%d, timeout=%d\n", aOperation, aTimeout)); 1226 1226 1227 Auto Lock lock(this);1227 AutoWriteLock alock (this); 1228 1228 CHECK_READY(); 1229 1229 … … 1275 1275 (forever || timeLeft > 0)) 1276 1276 { 1277 lock.unlock();1277 alock.unlock(); 1278 1278 // wait for the appropriate progress operation completion 1279 1279 rc = mProgresses [progress]-> WaitForOperationCompletion ( 1280 1280 operation, forever ? -1 : (LONG) timeLeft); 1281 lock.lock();1281 alock.lock(); 1282 1282 1283 1283 // the progress might have been uninitialized … … 1309 1309 STDMETHODIMP CombinedProgress::Cancel() 1310 1310 { 1311 Auto Lock lock(this);1311 AutoWriteLock alock (this); 1312 1312 CHECK_READY(); 1313 1313 -
trunk/src/VBox/Main/RemoteUSBDeviceImpl.cpp
r7207 r8083 52 52 LogFlowMember (("RemoteUSBDevice::init()\n")); 53 53 54 Auto Lock alock (this);54 AutoWriteLock alock (this); 55 55 ComAssertRet (!isReady(), E_UNEXPECTED); 56 56 … … 93 93 LogFlowMember (("RemoteUSBDevice::uninit()\n")); 94 94 95 Auto Lock alock (this);95 AutoWriteLock alock (this); 96 96 AssertReturn (isReady(), (void) 0); 97 97 … … 107 107 return E_INVALIDARG; 108 108 109 Auto Lock alock (this);109 AutoWriteLock alock (this); 110 110 CHECK_READY(); 111 111 … … 119 119 return E_INVALIDARG; 120 120 121 Auto Lock alock (this);121 AutoWriteLock alock (this); 122 122 CHECK_READY(); 123 123 … … 131 131 return E_INVALIDARG; 132 132 133 Auto Lock alock (this);133 AutoWriteLock alock (this); 134 134 CHECK_READY(); 135 135 … … 143 143 return E_INVALIDARG; 144 144 145 Auto Lock alock (this);145 AutoWriteLock alock (this); 146 146 CHECK_READY(); 147 147 … … 155 155 return E_INVALIDARG; 156 156 157 Auto Lock alock (this);157 AutoWriteLock alock (this); 158 158 CHECK_READY(); 159 159 … … 167 167 return E_INVALIDARG; 168 168 169 Auto Lock alock (this);169 AutoWriteLock alock (this); 170 170 CHECK_READY(); 171 171 … … 179 179 return E_INVALIDARG; 180 180 181 Auto Lock alock (this);181 AutoWriteLock alock (this); 182 182 CHECK_READY(); 183 183 … … 191 191 return E_INVALIDARG; 192 192 193 Auto Lock alock (this);193 AutoWriteLock alock (this); 194 194 CHECK_READY(); 195 195 … … 203 203 return E_INVALIDARG; 204 204 205 Auto Lock alock (this);205 AutoWriteLock alock (this); 206 206 CHECK_READY(); 207 207 … … 215 215 return E_INVALIDARG; 216 216 217 Auto Lock alock (this);217 AutoWriteLock alock (this); 218 218 CHECK_READY(); 219 219 … … 227 227 return E_INVALIDARG; 228 228 229 Auto Lock alock (this);229 AutoWriteLock alock (this); 230 230 CHECK_READY(); 231 231 … … 239 239 return E_INVALIDARG; 240 240 241 Auto Lock alock (this);241 AutoWriteLock alock (this); 242 242 CHECK_READY(); 243 243 … … 255 255 return E_POINTER; 256 256 257 Auto Locklock (this);257 AutoWriteLock alock (this); 258 258 CHECK_READY(); 259 259 -
trunk/src/VBox/Main/SATAControllerImpl.cpp
r7992 r8083 105 105 unconst (mPeer) = aPeer; 106 106 107 Auto Lock thatlock (aPeer);107 AutoWriteLock thatlock (aPeer); 108 108 mData.share (aPeer->mData); 109 109 … … 133 133 /* mPeer is left null */ 134 134 135 Auto Lock thatlock (aPeer);135 AutoWriteLock thatlock (aPeer); 136 136 mData.attachCopy (aPeer->mData); 137 137 … … 177 177 CheckComRCReturnRC (autoCaller.rc()); 178 178 179 AutoRead erLock alock (this);179 AutoReadLock alock (this); 180 180 181 181 *aEnabled = mData->mEnabled; … … 196 196 CheckComRCReturnRC (adep.rc()); 197 197 198 Auto Lock alock (this);198 AutoWriteLock alock (this); 199 199 200 200 if (mData->mEnabled != aEnabled) … … 220 220 CheckComRCReturnRC (autoCaller.rc()); 221 221 222 AutoRead erLock alock (this);222 AutoReadLock alock (this); 223 223 224 224 *aPortCount = mData->mPortCount; … … 239 239 CheckComRCReturnRC (adep.rc()); 240 240 241 Auto Lock alock (this);241 AutoWriteLock alock (this); 242 242 243 243 if (mData->mPortCount != aPortCount) … … 295 295 Machine::AutoMutableStateDependency adep (mParent); 296 296 CheckComRCReturnRC (adep.rc()); 297 Auto Lock alock (this);297 AutoWriteLock alock (this); 298 298 299 299 switch (DevicePosition) … … 338 338 AssertComRCReturnRC (autoCaller.rc()); 339 339 340 Auto Lock alock (this);340 AutoWriteLock alock (this); 341 341 342 342 /* SATA Controller node (required) */ … … 374 374 CheckComRCReturnRC (autoCaller.rc()); 375 375 376 AutoRead erLock alock (this);376 AutoReadLock alock (this); 377 377 378 378 /* first, delete the entry */ … … 404 404 AssertComRCReturn (autoCaller.rc(), false); 405 405 406 AutoRead erLock alock (this);406 AutoReadLock alock (this); 407 407 408 408 if (mData.isBackedUp()) … … 418 418 AssertComRCReturn (autoCaller.rc(), false); 419 419 420 AutoRead erLock alock (this);420 AutoReadLock alock (this); 421 421 422 422 if (mData.hasActualChanges()) … … 436 436 AssertComRCReturn (adep.rc(), false); 437 437 438 Auto Lock alock (this);438 AutoWriteLock alock (this); 439 439 440 440 bool dataChanged = false; … … 475 475 { 476 476 // attach new data to the peer and reshare it 477 Auto Lock peerlock (mPeer);477 AutoWriteLock peerlock (mPeer); 478 478 mPeer->mData.attach (mData); 479 479 } -
trunk/src/VBox/Main/SerialPortImpl.cpp
r7992 r8083 97 97 AssertComRCReturnRC (thatCaller.rc()); 98 98 99 AutoRead erLock thatLock (aThat);99 AutoReadLock thatLock (aThat); 100 100 mData.share (aThat->mData); 101 101 … … 129 129 AssertComRCReturnRC (thatCaller.rc()); 130 130 131 AutoRead erLock thatLock (aThat);131 AutoReadLock thatLock (aThat); 132 132 mData.attachCopy (aThat->mData); 133 133 … … 177 177 AssertComRCReturnRC (autoCaller.rc()); 178 178 179 Auto Lock alock (this);179 AutoWriteLock alock (this); 180 180 181 181 /* Note: we assume that the default values for attributes of optional … … 237 237 AssertComRCReturnRC (autoCaller.rc()); 238 238 239 AutoRead erLock alock (this);239 AutoReadLock alock (this); 240 240 241 241 aPortNode.setValue <bool> ("enabled", !!mData->mEnabled); … … 282 282 AssertComRCReturn (autoCaller.rc(), false); 283 283 284 Auto Lock alock (this);284 AutoWriteLock alock (this); 285 285 286 286 bool changed = false; … … 361 361 CheckComRCReturnRC (autoCaller.rc()); 362 362 363 AutoRead erLock alock (this);363 AutoReadLock alock (this); 364 364 365 365 *aEnabled = mData->mEnabled; … … 379 379 CheckComRCReturnRC (adep.rc()); 380 380 381 Auto Lock alock (this);381 AutoWriteLock alock (this); 382 382 383 383 if (mData->mEnabled != aEnabled) … … 403 403 CheckComRCReturnRC (autoCaller.rc()); 404 404 405 AutoRead erLock alock (this);405 AutoReadLock alock (this); 406 406 407 407 *aHostMode = mData->mHostMode; … … 419 419 CheckComRCReturnRC (adep.rc()); 420 420 421 Auto Lock alock (this);421 AutoWriteLock alock (this); 422 422 423 423 HRESULT rc = S_OK; … … 471 471 CheckComRCReturnRC (autoCaller.rc()); 472 472 473 AutoRead erLock alock (this);473 AutoReadLock alock (this); 474 474 475 475 *aSlot = mData->mSlot; … … 486 486 CheckComRCReturnRC (autoCaller.rc()); 487 487 488 AutoRead erLock alock (this);488 AutoReadLock alock (this); 489 489 490 490 *aIRQ = mData->mIRQ; … … 510 510 CheckComRCReturnRC (adep.rc()); 511 511 512 Auto Lock alock (this);512 AutoWriteLock alock (this); 513 513 514 514 HRESULT rc = S_OK; … … 541 541 CheckComRCReturnRC (autoCaller.rc()); 542 542 543 AutoRead erLock alock (this);543 AutoReadLock alock (this); 544 544 545 545 *aIOBase = mData->mIOBase; … … 565 565 CheckComRCReturnRC (adep.rc()); 566 566 567 Auto Lock alock (this);567 AutoWriteLock alock (this); 568 568 569 569 HRESULT rc = S_OK; … … 596 596 CheckComRCReturnRC (autoCaller.rc()); 597 597 598 AutoRead erLock alock (this);598 AutoReadLock alock (this); 599 599 600 600 mData->mPath.cloneTo (aPath); … … 608 608 HRESULT SerialPort::checkSetPath (const BSTR aPath) 609 609 { 610 AssertReturn (is LockedOnCurrentThread(), E_FAIL);610 AssertReturn (isWriteLockOnCurrentThread(), E_FAIL); 611 611 612 612 if ((mData->mHostMode == PortMode_HostDevice || … … 630 630 CheckComRCReturnRC (adep.rc()); 631 631 632 Auto Lock alock (this);632 AutoWriteLock alock (this); 633 633 634 634 if (mData->mPath != aPath) … … 657 657 CheckComRCReturnRC (autoCaller.rc()); 658 658 659 AutoRead erLock alock (this);659 AutoReadLock alock (this); 660 660 661 661 *aServer = mData->mServer; … … 675 675 CheckComRCReturnRC (adep.rc()); 676 676 677 Auto Lock alock (this);677 AutoWriteLock alock (this); 678 678 679 679 if (mData->mServer != aServer) -
trunk/src/VBox/Main/SessionImpl.cpp
r8057 r8083 127 127 128 128 /* close() needs write lock */ 129 Auto Lock alock (this);129 AutoWriteLock alock (this); 130 130 131 131 if (mState != SessionState_Closed) … … 152 152 CheckComRCReturnRC (autoCaller.rc()); 153 153 154 AutoRead erLock alock (this);154 AutoReadLock alock (this); 155 155 156 156 *aState = mState; … … 167 167 CheckComRCReturnRC (autoCaller.rc()); 168 168 169 AutoRead erLock alock (this);169 AutoReadLock alock (this); 170 170 171 171 CHECK_OPEN(); … … 183 183 CheckComRCReturnRC (autoCaller.rc()); 184 184 185 AutoRead erLock alock (this);185 AutoReadLock alock (this); 186 186 187 187 CHECK_OPEN(); … … 206 206 CheckComRCReturnRC (autoCaller.rc()); 207 207 208 AutoRead erLock alock (this);208 AutoReadLock alock (this); 209 209 210 210 CHECK_OPEN(); … … 232 232 233 233 /* close() needs write lock */ 234 Auto Lock alock (this);234 AutoWriteLock alock (this); 235 235 236 236 CHECK_OPEN(); … … 249 249 AssertComRCReturn (autoCaller.rc(), autoCaller.rc()); 250 250 251 AutoRead erLock alock (this);251 AutoReadLock alock (this); 252 252 253 253 *aPid = (ULONG) RTProcSelf(); … … 264 264 AssertComRCReturn (autoCaller.rc(), autoCaller.rc()); 265 265 266 AutoRead erLock alock (this);266 AutoReadLock alock (this); 267 267 268 268 AssertReturn (mState == SessionState_Open, E_FAIL); … … 284 284 AssertComRCReturn (autoCaller.rc(), autoCaller.rc()); 285 285 286 Auto Lock alock (this);286 AutoWriteLock alock (this); 287 287 288 288 AssertReturn (mState == SessionState_Closed, E_FAIL); … … 355 355 AssertComRCReturn (autoCaller.rc(), autoCaller.rc()); 356 356 357 Auto Lock alock (this);357 AutoWriteLock alock (this); 358 358 359 359 AssertReturn (mState == SessionState_Closed || … … 432 432 } 433 433 434 AutoRead erLock alock (this);434 AutoReadLock alock (this); 435 435 436 436 if (mState == SessionState_Closing) … … 460 460 { 461 461 /* close() needs write lock */ 462 Auto Lock alock (this);462 AutoWriteLock alock (this); 463 463 464 464 LogFlowThisFunc (("mState=%d, mType=%d\n", mState, mType)); … … 502 502 AssertComRCReturn (autoCaller.rc(), autoCaller.rc()); 503 503 504 AutoRead erLock alock (this);504 AutoReadLock alock (this); 505 505 AssertReturn (mState == SessionState_Open && 506 506 mType == SessionType_Direct, E_FAIL); … … 516 516 AssertComRCReturn (autoCaller.rc(), autoCaller.rc()); 517 517 518 AutoRead erLock alock (this);518 AutoReadLock alock (this); 519 519 AssertReturn (mState == SessionState_Open && 520 520 mType == SessionType_Direct, E_FAIL); … … 530 530 AssertComRCReturn (autoCaller.rc(), autoCaller.rc()); 531 531 532 AutoRead erLock alock (this);532 AutoReadLock alock (this); 533 533 AssertReturn (mState == SessionState_Open && 534 534 mType == SessionType_Direct, E_FAIL); … … 544 544 AssertComRCReturn (autoCaller.rc(), autoCaller.rc()); 545 545 546 AutoRead erLock alock (this);546 AutoReadLock alock (this); 547 547 AssertReturn (mState == SessionState_Open && 548 548 mType == SessionType_Direct, E_FAIL); … … 558 558 AssertComRCReturn (autoCaller.rc(), autoCaller.rc()); 559 559 560 AutoRead erLock alock (this);560 AutoReadLock alock (this); 561 561 AssertReturn (mState == SessionState_Open && 562 562 mType == SessionType_Direct, E_FAIL); … … 572 572 AssertComRCReturn (autoCaller.rc(), autoCaller.rc()); 573 573 574 AutoRead erLock alock (this);574 AutoReadLock alock (this); 575 575 AssertReturn (mState == SessionState_Open && 576 576 mType == SessionType_Direct, E_FAIL); … … 586 586 AssertComRCReturn (autoCaller.rc(), autoCaller.rc()); 587 587 588 AutoRead erLock alock (this);588 AutoReadLock alock (this); 589 589 AssertReturn (mState == SessionState_Open && 590 590 mType == SessionType_Direct, E_FAIL); … … 600 600 AssertComRCReturn (autoCaller.rc(), autoCaller.rc()); 601 601 602 AutoRead erLock alock (this);602 AutoReadLock alock (this); 603 603 AssertReturn (mState == SessionState_Open && 604 604 mType == SessionType_Direct, E_FAIL); … … 616 616 AssertComRCReturn (autoCaller.rc(), autoCaller.rc()); 617 617 618 AutoRead erLock alock (this);618 AutoReadLock alock (this); 619 619 AssertReturn (mState == SessionState_Open && 620 620 mType == SessionType_Direct, E_FAIL); … … 631 631 AssertComRCReturn (autoCaller.rc(), autoCaller.rc()); 632 632 633 AutoRead erLock alock (this);633 AutoReadLock alock (this); 634 634 AssertReturn (mState == SessionState_Open && 635 635 mType == SessionType_Direct, E_FAIL); … … 643 643 AssertComRCReturn (autoCaller.rc(), autoCaller.rc()); 644 644 645 AutoRead erLock alock (this);645 AutoReadLock alock (this); 646 646 AssertReturn (mState == SessionState_Open && 647 647 mType == SessionType_Direct, E_FAIL); … … 671 671 AssertComRCReturnRC (autoCaller.rc()); 672 672 673 Auto Lock alock (this);673 AutoWriteLock alock (this); 674 674 675 675 LogFlowThisFunc (("mState=%d, mType=%d\n", mState, mType)); -
trunk/src/VBox/Main/SnapshotImpl.cpp
r6076 r8083 69 69 ComAssertRet (!aId.isEmpty() && aName && aMachine, E_INVALIDARG); 70 70 71 Auto Lock alock (this);71 AutoWriteLock alock (this); 72 72 ComAssertRet (!isReady(), E_UNEXPECTED); 73 73 … … 97 97 LogFlowMember (("Snapshot::uninit()\n")); 98 98 99 Auto Lock alock (this);99 AutoWriteLock alock (this); 100 100 101 101 LogFlowMember (("Snapshot::uninit(): isReady=%d\n", isReady())); … … 132 132 LogFlowMember (("Snapshot::discard()\n")); 133 133 134 Auto Lock alock (this);134 AutoWriteLock alock (this); 135 135 AssertReturn (isReady(), (void) 0); 136 136 137 137 { 138 Auto Lock chLock (childrenLock());138 AutoWriteLock chLock (childrenLock ()); 139 139 AssertReturn (!!mParent || children().size() <= 1, (void) 0); 140 140 … … 143 143 { 144 144 ComObjPtr <Snapshot> child = *it; 145 Auto Lock childLock (child);145 AutoWriteLock childLock (child); 146 146 // reparent the child 147 147 child->mParent = mParent; … … 166 166 return E_POINTER; 167 167 168 Auto Lock alock (this);168 AutoWriteLock alock (this); 169 169 CHECK_READY(); 170 170 … … 178 178 return E_POINTER; 179 179 180 Auto Lock alock (this);180 AutoWriteLock alock (this); 181 181 CHECK_READY(); 182 182 … … 194 194 return E_INVALIDARG; 195 195 196 Auto Lock alock (this);196 AutoWriteLock alock (this); 197 197 CHECK_READY(); 198 198 … … 214 214 return E_POINTER; 215 215 216 Auto Lock alock (this);216 AutoWriteLock alock (this); 217 217 CHECK_READY(); 218 218 … … 226 226 return E_INVALIDARG; 227 227 228 Auto Lock alock (this);228 AutoWriteLock alock (this); 229 229 CHECK_READY(); 230 230 … … 246 246 return E_POINTER; 247 247 248 Auto Lock alock (this);248 AutoWriteLock alock (this); 249 249 CHECK_READY(); 250 250 … … 258 258 return E_POINTER; 259 259 260 Auto Lock alock (this);260 AutoWriteLock alock (this); 261 261 CHECK_READY(); 262 262 … … 270 270 return E_POINTER; 271 271 272 Auto Lock alock (this);272 AutoWriteLock alock (this); 273 273 CHECK_READY(); 274 274 … … 282 282 return E_POINTER; 283 283 284 Auto Lock alock (this);284 AutoWriteLock alock (this); 285 285 CHECK_READY(); 286 286 … … 294 294 return E_POINTER; 295 295 296 Auto Lock alock (this);297 CHECK_READY(); 298 299 Auto Lock chLock (childrenLock());296 AutoWriteLock alock (this); 297 CHECK_READY(); 298 299 AutoWriteLock chLock (childrenLock ()); 300 300 301 301 ComObjPtr <SnapshotCollection> collection; … … 325 325 ULONG Snapshot::descendantCount() 326 326 { 327 Auto Lock alock(this);327 AutoWriteLock alock(this); 328 328 AssertReturn (isReady(), 0); 329 329 330 Auto Lock chLock (childrenLock());330 AutoWriteLock chLock (childrenLock ()); 331 331 332 332 ULONG count = children().size(); … … 349 349 ComObjPtr <Snapshot> child; 350 350 351 Auto Lock alock (this);351 AutoWriteLock alock (this); 352 352 AssertReturn (isReady(), child); 353 353 … … 356 356 else 357 357 { 358 Auto Lock chLock (childrenLock());358 AutoWriteLock chLock (childrenLock ()); 359 359 for (SnapshotList::const_iterator it = children().begin(); 360 360 !child && it != children().end(); ++ it) … … 377 377 AssertReturn (aName, child); 378 378 379 Auto Lock alock (this);379 AutoWriteLock alock (this); 380 380 AssertReturn (isReady(), child); 381 381 … … 384 384 else 385 385 { 386 Auto Lock chLock (childrenLock());386 AutoWriteLock chLock (childrenLock ()); 387 387 for (SnapshotList::const_iterator it = children().begin(); 388 388 !child && it != children().end(); ++ it) … … 398 398 * Returns @c true if the given DVD image is attached to this snapshot or any 399 399 * of its children, recursively. 400 * 400 * 401 401 * @param aId Image ID to check. 402 * 402 * 403 403 * @note Locks this object for reading. 404 404 */ 405 405 bool Snapshot::isDVDImageUsed (const Guid &aId) 406 406 { 407 AutoRead erLock alock (this);407 AutoReadLock alock (this); 408 408 AssertReturn (isReady(), false); 409 409 … … 423 423 } 424 424 425 AutoRead erLock chLock (childrenLock());425 AutoReadLock chLock (childrenLock()); 426 426 for (SnapshotList::const_iterator it = children().begin(); 427 427 it != children().end(); ++ it) … … 434 434 } 435 435 436 /** 436 /** 437 437 * Returns @c true if the given Floppy image is attached to this snapshot or any 438 438 * of its children, recursively. 439 * 439 * 440 440 * @param aId Image ID to check. 441 * 441 * 442 442 * @note Locks this object for reading. 443 443 */ 444 444 bool Snapshot::isFloppyImageUsed (const Guid &aId) 445 445 { 446 AutoRead erLock alock (this);446 AutoReadLock alock (this); 447 447 AssertReturn (isReady(), false); 448 448 … … 462 462 } 463 463 464 AutoRead erLock chLock (childrenLock());464 AutoReadLock chLock (childrenLock()); 465 465 for (SnapshotList::const_iterator it = children().begin(); 466 466 it != children().end(); ++ it) … … 491 491 AssertReturnVoid (aNewPath); 492 492 493 Auto Lock alock (this);493 AutoWriteLock alock (this); 494 494 AssertReturnVoid (isReady()); 495 495 … … 506 506 } 507 507 508 Auto Lock chLock (childrenLock());508 AutoWriteLock chLock (childrenLock ()); 509 509 for (SnapshotList::const_iterator it = children().begin(); 510 510 it != children().end(); ++ it) -
trunk/src/VBox/Main/SystemPropertiesImpl.cpp
r6096 r8083 60 60 ComAssertRet (aParent, E_FAIL); 61 61 62 Auto Lock alock (this);62 AutoWriteLock alock (this); 63 63 ComAssertRet (!isReady(), E_UNEXPECTED); 64 64 … … 84 84 LogFlowMember (("SystemProperties::uninit()\n")); 85 85 86 Auto Lock alock (this);86 AutoWriteLock alock (this); 87 87 AssertReturn (isReady(), (void) 0); 88 88 … … 98 98 if (!minRAM) 99 99 return E_POINTER; 100 Auto Lock lock(this);100 AutoWriteLock alock (this); 101 101 CHECK_READY(); 102 102 … … 110 110 if (!maxRAM) 111 111 return E_POINTER; 112 Auto Lock lock(this);112 AutoWriteLock alock (this); 113 113 CHECK_READY(); 114 114 … … 122 122 if (!minVRAM) 123 123 return E_POINTER; 124 Auto Lock lock(this);124 AutoWriteLock alock (this); 125 125 CHECK_READY(); 126 126 … … 134 134 if (!maxVRAM) 135 135 return E_POINTER; 136 Auto Lock lock(this);136 AutoWriteLock alock (this); 137 137 CHECK_READY(); 138 138 … … 146 146 if (!maxMonitors) 147 147 return E_POINTER; 148 Auto Lock lock(this);148 AutoWriteLock alock (this); 149 149 CHECK_READY(); 150 150 … … 158 158 if (!maxVDISize) 159 159 return E_POINTER; 160 Auto Lock lock(this);160 AutoWriteLock alock (this); 161 161 CHECK_READY(); 162 162 … … 179 179 if (!count) 180 180 return E_POINTER; 181 Auto Locklock (this);181 AutoWriteLock alock (this); 182 182 CHECK_READY(); 183 183 … … 191 191 if (!count) 192 192 return E_POINTER; 193 Auto Locklock (this);193 AutoWriteLock alock (this); 194 194 CHECK_READY(); 195 195 … … 203 203 if (!count) 204 204 return E_POINTER; 205 Auto Locklock (this);205 AutoWriteLock alock (this); 206 206 CHECK_READY(); 207 207 … … 215 215 if (!aMaxBootPosition) 216 216 return E_POINTER; 217 Auto Locklock (this);217 AutoWriteLock alock (this); 218 218 CHECK_READY(); 219 219 … … 228 228 return E_POINTER; 229 229 230 Auto Lock alock (this);230 AutoWriteLock alock (this); 231 231 CHECK_READY(); 232 232 … … 238 238 STDMETHODIMP SystemProperties::COMSETTER(DefaultVDIFolder) (INPTR BSTR aDefaultVDIFolder) 239 239 { 240 Auto Lock alock (this);240 AutoWriteLock alock (this); 241 241 CHECK_READY(); 242 242 … … 254 254 return E_POINTER; 255 255 256 Auto Lock alock (this);256 AutoWriteLock alock (this); 257 257 CHECK_READY(); 258 258 … … 264 264 STDMETHODIMP SystemProperties::COMSETTER(DefaultMachineFolder) (INPTR BSTR aDefaultMachineFolder) 265 265 { 266 Auto Lock alock (this);266 AutoWriteLock alock (this); 267 267 CHECK_READY(); 268 268 … … 280 280 return E_POINTER; 281 281 282 Auto Lock alock (this);282 AutoWriteLock alock (this); 283 283 CHECK_READY(); 284 284 … … 290 290 STDMETHODIMP SystemProperties::COMSETTER(RemoteDisplayAuthLibrary) (INPTR BSTR aRemoteDisplayAuthLibrary) 291 291 { 292 Auto Lock alock (this);292 AutoWriteLock alock (this); 293 293 CHECK_READY(); 294 294 … … 306 306 return E_POINTER; 307 307 308 Auto Lock alock (this);308 AutoWriteLock alock (this); 309 309 CHECK_READY(); 310 310 … … 316 316 STDMETHODIMP SystemProperties::COMSETTER(WebServiceAuthLibrary) (INPTR BSTR aWebServiceAuthLibrary) 317 317 { 318 Auto Lock alock (this);318 AutoWriteLock alock (this); 319 319 CHECK_READY(); 320 320 … … 332 332 return E_POINTER; 333 333 334 Auto Lock alock (this);334 AutoWriteLock alock (this); 335 335 CHECK_READY(); 336 336 … … 342 342 STDMETHODIMP SystemProperties::COMSETTER(HWVirtExEnabled) (BOOL enabled) 343 343 { 344 Auto Lock alock (this);344 AutoWriteLock alock (this); 345 345 CHECK_READY(); 346 346 … … 356 356 return E_POINTER; 357 357 358 Auto Lock alock (this);358 AutoWriteLock alock (this); 359 359 CHECK_READY(); 360 360 … … 366 366 STDMETHODIMP SystemProperties::COMSETTER(LogHistoryCount) (ULONG count) 367 367 { 368 Auto Lock alock (this);368 AutoWriteLock alock (this); 369 369 CHECK_READY(); 370 370 … … 382 382 using namespace settings; 383 383 384 Auto Locklock (this);384 AutoWriteLock alock (this); 385 385 CHECK_READY(); 386 386 … … 421 421 using namespace settings; 422 422 423 Auto Locklock (this);423 AutoWriteLock alock (this); 424 424 CHECK_READY(); 425 425 -
trunk/src/VBox/Main/USBControllerImpl.cpp
r7992 r8083 113 113 unconst (mPeer) = aPeer; 114 114 115 Auto Lock thatlock (aPeer);115 AutoWriteLock thatlock (aPeer); 116 116 mData.share (aPeer->mData); 117 117 … … 155 155 /* mPeer is left null */ 156 156 157 Auto Lock thatlock (aPeer);157 AutoWriteLock thatlock (aPeer); 158 158 mData.attachCopy (aPeer->mData); 159 159 … … 216 216 CheckComRCReturnRC (autoCaller.rc()); 217 217 218 AutoRead erLock alock (this);218 AutoReadLock alock (this); 219 219 220 220 *aEnabled = mData->mEnabled; … … 235 235 CheckComRCReturnRC (adep.rc()); 236 236 237 Auto Lock alock (this);237 AutoWriteLock alock (this); 238 238 239 239 if (mData->mEnabled != aEnabled) … … 259 259 CheckComRCReturnRC (autoCaller.rc()); 260 260 261 AutoRead erLock alock (this);261 AutoReadLock alock (this); 262 262 263 263 *aEnabled = mData->mEnabledEhci; … … 277 277 CheckComRCReturnRC (adep.rc()); 278 278 279 Auto Lock alock (this);279 AutoWriteLock alock (this); 280 280 281 281 if (mData->mEnabledEhci != aEnabled) … … 365 365 CheckComRCReturnRC (autoCaller.rc()); 366 366 367 AutoRead erLock alock (this);367 AutoReadLock alock (this); 368 368 369 369 ComObjPtr <USBDeviceFilterCollection> collection; … … 397 397 CheckComRCReturnRC (adep.rc()); 398 398 399 Auto Lock alock (this);399 AutoWriteLock alock (this); 400 400 401 401 ComObjPtr <USBDeviceFilter> filter; … … 426 426 CheckComRCReturnRC (adep.rc()); 427 427 428 Auto Lock alock (this);428 AutoWriteLock alock (this); 429 429 430 430 ComObjPtr <USBDeviceFilter> filter = getDependentChild (aFilter); … … 491 491 CheckComRCReturnRC (adep.rc()); 492 492 493 Auto Lock alock (this);493 AutoWriteLock alock (this); 494 494 495 495 if (!mDeviceFilters->size()) … … 566 566 AssertComRCReturnRC (autoCaller.rc()); 567 567 568 Auto Lock alock (this);568 AutoWriteLock alock (this); 569 569 570 570 /* Note: we assume that the default values for attributes of optional … … 643 643 CheckComRCReturnRC (autoCaller.rc()); 644 644 645 AutoRead erLock alock (this);645 AutoReadLock alock (this); 646 646 647 647 /* first, delete the entry */ … … 668 668 while (it != mDeviceFilters->end()) 669 669 { 670 Auto Lock filterLock (*it);670 AutoWriteLock filterLock (*it); 671 671 const USBDeviceFilter::Data &data = (*it)->data(); 672 672 … … 725 725 AssertComRCReturn (autoCaller.rc(), false); 726 726 727 AutoRead erLock alock (this);727 AutoReadLock alock (this); 728 728 729 729 if (mData.isBackedUp() … … 755 755 AssertComRCReturn (autoCaller.rc(), false); 756 756 757 AutoRead erLock alock (this);757 AutoReadLock alock (this); 758 758 759 759 if (mData.hasActualChanges()) … … 824 824 AssertComRCReturn (adep.rc(), false); 825 825 826 Auto Lock alock (this);826 AutoWriteLock alock (this); 827 827 828 828 bool dataChanged = false; … … 947 947 { 948 948 /* attach new data to the peer and reshare it */ 949 Auto Lock peerlock (mPeer);949 AutoWriteLock peerlock (mPeer); 950 950 mPeer->mData.attach (mData); 951 951 } … … 962 962 if (mPeer) 963 963 { 964 Auto Lock peerlock (mPeer);964 AutoWriteLock peerlock (mPeer); 965 965 /* commit all changes to new filters (this will reshare data with 966 966 * peers for those who have peers) */ … … 1181 1181 AssertComRCReturn (autoCaller.rc(), false); 1182 1182 1183 AutoRead erLock alock (this);1183 AutoReadLock alock (this); 1184 1184 1185 1185 /* Disabled USB controllers cannot actually work with USB devices */ … … 1192 1192 ++ it) 1193 1193 { 1194 Auto Lock filterLock (*it);1194 AutoWriteLock filterLock (*it); 1195 1195 if (aDevice->isMatch ((*it)->data())) 1196 1196 { … … 1222 1222 AssertComRCReturn (autoCaller.rc(), false); 1223 1223 1224 AutoRead erLock alock (this);1224 AutoReadLock alock (this); 1225 1225 1226 1226 /* Disabled USB controllers cannot actually work with USB devices */ … … 1290 1290 ++ it) 1291 1291 { 1292 Auto Lock filterLock (*it);1292 AutoWriteLock filterLock (*it); 1293 1293 const USBDeviceFilter::Data &aData = (*it)->data(); 1294 1294 … … 1326 1326 AssertComRCReturn (autoCaller.rc(), false); 1327 1327 1328 AutoRead erLock alock (this);1328 AutoReadLock alock (this); 1329 1329 1330 1330 USBProxyService *service = mParent->virtualBox()->host()->usbProxyService(); -
trunk/src/VBox/Main/USBDeviceImpl.cpp
r5999 r8083 49 49 HRESULT OUSBDevice::init(IUSBDevice *aUSBDevice) 50 50 { 51 Auto Lock lock(this);51 AutoWriteLock alock (this); 52 52 AssertReturn (!isReady(), E_UNEXPECTED); 53 53 … … 109 109 return E_POINTER; 110 110 111 Auto Lock lock(this);111 AutoWriteLock alock (this); 112 112 CHECK_READY(); 113 113 … … 128 128 return E_POINTER; 129 129 130 Auto Lock lock(this);130 AutoWriteLock alock (this); 131 131 CHECK_READY(); 132 132 … … 147 147 return E_POINTER; 148 148 149 Auto Lock lock(this);149 AutoWriteLock alock (this); 150 150 CHECK_READY(); 151 151 … … 166 166 return E_POINTER; 167 167 168 Auto Lock lock(this);168 AutoWriteLock alock (this); 169 169 CHECK_READY(); 170 170 … … 184 184 return E_POINTER; 185 185 186 Auto Lock lock(this);186 AutoWriteLock alock (this); 187 187 CHECK_READY(); 188 188 … … 203 203 return E_POINTER; 204 204 205 Auto Lock lock(this);205 AutoWriteLock alock (this); 206 206 CHECK_READY(); 207 207 … … 222 222 return E_POINTER; 223 223 224 Auto Lock lock(this);224 AutoWriteLock alock (this); 225 225 CHECK_READY(); 226 226 … … 241 241 return E_POINTER; 242 242 243 Auto Lock lock(this);243 AutoWriteLock alock (this); 244 244 CHECK_READY(); 245 245 … … 253 253 return E_POINTER; 254 254 255 Auto Lock lock(this);255 AutoWriteLock alock (this); 256 256 CHECK_READY(); 257 257 … … 265 265 return E_POINTER; 266 266 267 Auto Lock lock(this);267 AutoWriteLock alock (this); 268 268 CHECK_READY(); 269 269 … … 277 277 return E_POINTER; 278 278 279 Auto Lock lock(this);279 AutoWriteLock alock (this); 280 280 CHECK_READY(); 281 281 … … 289 289 return E_POINTER; 290 290 291 Auto Lock lock(this);291 AutoWriteLock alock (this); 292 292 CHECK_READY(); 293 293 -
trunk/src/VBox/Main/VirtualBoxBase.cpp
r7992 r8083 21 21 #include <windows.h> 22 22 #include <dbghelp.h> 23 #else / / !defined (VBOX_WITH_XPCOM)23 #else /* !defined (VBOX_WITH_XPCOM) */ 24 24 #include <nsIServiceManager.h> 25 25 #include <nsIExceptionService.h> 26 #endif / / !defined (VBOX_WITH_XPCOM)26 #endif /* !defined (VBOX_WITH_XPCOM) */ 27 27 28 28 #include "VirtualBoxBase.h" … … 59 59 } 60 60 61 // AutoLock::Lockable interface61 // util::Lockable interface 62 62 RWLockHandle *VirtualBoxBaseNEXT_base::lockHandle() const 63 63 { … … 127 127 bool aLimited /* = false */) 128 128 { 129 Auto Lock stateLock (mStateLock);129 AutoWriteLock stateLock (mStateLock); 130 130 131 131 HRESULT rc = E_UNEXPECTED; … … 204 204 void VirtualBoxBaseNEXT_base::releaseCaller() 205 205 { 206 Auto Lock stateLock (mStateLock);206 AutoWriteLock stateLock (mStateLock); 207 207 208 208 if (mState == Ready || mState == Limited) … … 262 262 Assert (aObj); 263 263 264 Auto Lock stateLock (mObj->mStateLock);264 AutoWriteLock stateLock (mObj->mStateLock); 265 265 266 266 Assert (mObj->mState != InInit && mObj->mState != InUninit && … … 285 285 return; 286 286 287 Auto Lock stateLock (mObj->mStateLock);287 AutoWriteLock stateLock (mObj->mStateLock); 288 288 289 289 Assert (mObj->mState == InInit); … … 335 335 Assert (aObj); 336 336 337 Auto Lock stateLock (mObj->mStateLock);337 AutoWriteLock stateLock (mObj->mStateLock); 338 338 339 339 Assert (mObj->mState != InInit && mObj->mState != InUninit && … … 358 358 return; 359 359 360 Auto Lock stateLock (mObj->mStateLock);360 AutoWriteLock stateLock (mObj->mStateLock); 361 361 362 362 Assert (mObj->mState == InInit); … … 397 397 Assert (aObj); 398 398 399 Auto Lock stateLock (mObj->mStateLock);399 AutoWriteLock stateLock (mObj->mStateLock); 400 400 401 401 Assert (mObj->mState != InInit); … … 448 448 return; 449 449 450 Auto Lock stateLock (mObj->mStateLock);450 AutoWriteLock stateLock (mObj->mStateLock); 451 451 452 452 Assert (mObj->mState == InUninit); … … 481 481 const char *comment) 482 482 { 483 // Log(("VirtualBoxBase::translate:\n" 484 // " context={%s}\n" 485 // " sourceT={%s}\n" 486 // " comment={%s}\n", 487 // context, sourceText, comment)); 483 #if 0 484 Log(("VirtualBoxBase::translate:\n" 485 " context={%s}\n" 486 " sourceT={%s}\n" 487 " comment={%s}\n", 488 context, sourceText, comment)); 489 #endif 488 490 489 491 /// @todo (dmik) incorporate Qt translation file parsing and lookup … … 491 493 return sourceText; 492 494 } 493 494 /// @todo (dmik)495 // Using StackWalk() is not necessary here once we have ASMReturnAddress().496 // Delete later.497 498 #if defined(DEBUG) && 0499 500 //static501 void VirtualBoxBase::AutoLock::CritSectEnter (RTCRITSECT *aLock)502 {503 AssertReturn (aLock, (void) 0);504 505 #if (defined(RT_OS_LINUX) || defined(RT_OS_OS2)) && defined(__GNUC__)506 507 RTCritSectEnterDebug (aLock,508 "AutoLock::lock()/enter() return address >>>", 0,509 (RTUINTPTR) __builtin_return_address (1));510 511 #elif defined(RT_OS_WINDOWS)512 513 STACKFRAME sf;514 memset (&sf, 0, sizeof(sf));515 {516 __asm eip:517 __asm mov eax, eip518 __asm lea ebx, sf519 __asm mov [ebx]sf.AddrPC.Offset, eax520 __asm mov [ebx]sf.AddrStack.Offset, esp521 __asm mov [ebx]sf.AddrFrame.Offset, ebp522 }523 sf.AddrPC.Mode = AddrModeFlat;524 sf.AddrStack.Mode = AddrModeFlat;525 sf.AddrFrame.Mode = AddrModeFlat;526 527 HANDLE process = GetCurrentProcess();528 HANDLE thread = GetCurrentThread();529 530 // get our stack frame531 BOOL ok = StackWalk (IMAGE_FILE_MACHINE_I386, process, thread,532 &sf, NULL, NULL,533 SymFunctionTableAccess,534 SymGetModuleBase,535 NULL);536 // sanity check of the returned stack frame537 ok = ok & (sf.AddrFrame.Offset != 0);538 if (ok)539 {540 // get the stack frame of our caller which is either541 // lock() or enter()542 ok = StackWalk (IMAGE_FILE_MACHINE_I386, process, thread,543 &sf, NULL, NULL,544 SymFunctionTableAccess,545 SymGetModuleBase,546 NULL);547 // sanity check of the returned stack frame548 ok = ok & (sf.AddrFrame.Offset != 0);549 }550 551 if (ok)552 {553 // the return address here should be the code where lock() or enter()554 // has been called from (to be more precise, where it will return)555 RTCritSectEnterDebug (aLock,556 "AutoLock::lock()/enter() return address >>>", 0,557 (RTUINTPTR) sf.AddrReturn.Offset);558 }559 else560 {561 RTCritSectEnter (aLock);562 }563 564 #else565 566 RTCritSectEnter (aLock);567 568 #endif // defined(RT_OS_LINUX)...569 }570 571 #endif // defined(DEBUG)572 495 573 496 // VirtualBoxSupportTranslationBase methods … … 827 750 LogFlowThisFuncEnter(); 828 751 829 Auto Lock alock (this);830 Auto Lock mapLock (mMapLock);752 AutoWriteLock alock (this); 753 AutoWriteLock mapLock (mMapLock); 831 754 832 755 LogFlowThisFunc (("count=%d...\n", mDependentChildren.size())); … … 899 822 AssertReturn (!!unk, NULL); 900 823 901 Auto Lock alock (mMapLock);824 AutoWriteLock alock (mMapLock); 902 825 if (mUninitDoneSem != NIL_RTSEMEVENT) 903 826 return NULL; … … 915 838 AssertReturn (!!unk && child, (void) 0); 916 839 917 Auto Lock alock (mMapLock);840 AutoWriteLock alock (mMapLock); 918 841 919 842 if (mUninitDoneSem != NIL_RTSEMEVENT) … … 938 861 AssertReturn (!!unk, (void) 0); 939 862 940 Auto Lock alock (mMapLock);863 AutoWriteLock alock (mMapLock); 941 864 942 865 if (mUninitDoneSem != NIL_RTSEMEVENT) … … 975 898 LogFlowThisFuncEnter(); 976 899 977 Auto Lock mapLock (mMapLock);900 AutoWriteLock mapLock (mMapLock); 978 901 979 902 LogFlowThisFunc (("count=%u...\n", mDependentChildren.size())); … … 1045 968 AssertReturn (!!aUnk, NULL); 1046 969 1047 Auto Lock alock (mMapLock);970 AutoWriteLock alock (mMapLock); 1048 971 1049 972 /* return NULL if uninitDependentChildren() is in action */ … … 1062 985 AssertReturnVoid (aUnk && aChild); 1063 986 1064 Auto Lock alock (mMapLock);987 AutoWriteLock alock (mMapLock); 1065 988 1066 989 if (mUninitDoneSem != NIL_RTSEMEVENT) … … 1082 1005 AssertReturnVoid (aUnk); 1083 1006 1084 Auto Lock alock (mMapLock);1007 AutoWriteLock alock (mMapLock); 1085 1008 1086 1009 if (mUninitDoneSem != NIL_RTSEMEVENT) … … 1120 1043 void VirtualBoxBaseWithTypedChildrenNEXT <C>::uninitDependentChildren() 1121 1044 { 1122 Auto Lock mapLock (mMapLock);1045 AutoWriteLock mapLock (mMapLock); 1123 1046 1124 1047 if (mDependentChildren.size()) -
trunk/src/VBox/Main/VirtualBoxImpl.cpp
r8055 r8083 489 489 CheckComRCReturnRC (autoCaller.rc()); 490 490 491 AutoRead erLock alock (this);491 AutoReadLock alock (this); 492 492 493 493 mData.mSettingsFileVersion.cloneTo (aSettingsFileVersion); … … 547 547 collection.createObject(); 548 548 549 AutoRead erLock alock (this);549 AutoReadLock alock (this); 550 550 collection->init (mData.mMachines); 551 551 collection.queryInterfaceTo (aMachines); … … 566 566 CheckComRCReturnRC (autoCaller.rc()); 567 567 568 AutoRead erLock alock (this);568 AutoReadLock alock (this); 569 569 570 570 SafeIfaceArray <IMachine> machines (mData.mMachines); … … 588 588 collection.createObject(); 589 589 590 AutoRead erLock alock (this);590 AutoReadLock alock (this); 591 591 collection->init (mData.mHardDisks); 592 592 collection.queryInterfaceTo (aHardDisks); … … 609 609 collection.createObject(); 610 610 611 AutoRead erLock alock (this);611 AutoReadLock alock (this); 612 612 collection->init (mData.mDVDImages); 613 613 collection.queryInterfaceTo (aDVDImages); … … 630 630 collection.createObject(); 631 631 632 AutoRead erLock alock (this);632 AutoReadLock alock (this); 633 633 collection->init (mData.mFloppyImages); 634 634 collection.queryInterfaceTo (aFloppyImages); … … 651 651 collection.createObject(); 652 652 653 AutoRead erLock alock (this);653 AutoReadLock alock (this); 654 654 collection->init (mData.mProgressOperations); 655 655 collection.queryInterfaceTo (aOperations); … … 672 672 collection.createObject(); 673 673 674 AutoRead erLock alock (this);674 AutoReadLock alock (this); 675 675 collection->init (mData.mGuestOSTypes); 676 676 collection.queryInterfaceTo (aGuestOSTypes); … … 726 726 if (settingsFile.isEmpty()) 727 727 { 728 AutoRead erLock propsLock (systemProperties());728 AutoReadLock propsLock (systemProperties()); 729 729 /* we use the non-full folder value below to keep the path relative */ 730 730 settingsFile = systemProperties()->defaultMachineFolder(); … … 926 926 { 927 927 /* take a copy for safe iteration outside the lock */ 928 AutoRead erLock alock (this);928 AutoReadLock alock (this); 929 929 machines = mData.mMachines; 930 930 } … … 940 940 if (machCaller.state() == Machine::Ready) 941 941 { 942 AutoRead erLock machLock (*it);942 AutoReadLock machLock (*it); 943 943 if ((*it)->name() == aName) 944 944 machine = *it; … … 971 971 CheckComRCReturnRC (autoCaller.rc()); 972 972 973 Auto Lock alock (this);973 AutoWriteLock alock (this); 974 974 975 975 ComObjPtr <Machine> machine; … … 1083 1083 if (!RTPathHavePath (loc)) 1084 1084 { 1085 Auto Lock propsLock (mData.mSystemProperties);1085 AutoWriteLock propsLock (mData.mSystemProperties); 1086 1086 location = Utf8StrFmt ("%ls%c%s", 1087 1087 mData.mSystemProperties->defaultVDIFolder().raw(), … … 1119 1119 if (!RTPathHavePath (fp)) 1120 1120 { 1121 Auto Lock propsLock (mData.mSystemProperties);1121 AutoWriteLock propsLock (mData.mSystemProperties); 1122 1122 path = Utf8StrFmt ("%ls%c%s", 1123 1123 mData.mSystemProperties->defaultVDIFolder().raw(), … … 1201 1201 if (!RTPathHavePath (location)) 1202 1202 { 1203 Auto Lock propsLock (mData.mSystemProperties);1203 AutoWriteLock propsLock (mData.mSystemProperties); 1204 1204 location = Utf8StrFmt ("%ls%c%s", 1205 1205 mData.mSystemProperties->defaultVDIFolder().raw(), … … 1245 1245 if (!RTPathHavePath (fp)) 1246 1246 { 1247 Auto Lock propsLock (mData.mSystemProperties);1247 AutoWriteLock propsLock (mData.mSystemProperties); 1248 1248 path = Utf8StrFmt ("%ls%c%s", 1249 1249 mData.mSystemProperties->defaultVDIFolder().raw(), … … 1405 1405 CheckComRCReturnRC (autoCaller.rc()); 1406 1406 1407 AutoRead erLock alock (this);1407 AutoReadLock alock (this); 1408 1408 1409 1409 Guid uuid = Guid (aId); … … 1429 1429 CheckComRCReturnRC (autoCaller.rc()); 1430 1430 1431 Auto Lock alock (this);1431 AutoWriteLock alock (this); 1432 1432 1433 1433 *aDVDImage = NULL; … … 1574 1574 CheckComRCReturnRC (autoCaller.rc()); 1575 1575 1576 AutoRead erLock alock (this);1576 AutoReadLock alock (this); 1577 1577 1578 1578 Guid uuid = Guid (aId); … … 1598 1598 CheckComRCReturnRC (autoCaller.rc()); 1599 1599 1600 Auto Lock alock (this);1600 AutoWriteLock alock (this); 1601 1601 1602 1602 *aFloppyImage = NULL; … … 1639 1639 *aType = NULL; 1640 1640 1641 AutoRead erLock alock (this);1641 AutoReadLock alock (this); 1642 1642 1643 1643 for (GuestOSTypeList::iterator it = mData.mGuestOSTypes.begin(); … … 1703 1703 1704 1704 /* serialize file access (prevent writes) */ 1705 AutoRead erLock alock (this);1705 AutoReadLock alock (this); 1706 1706 1707 1707 try … … 1801 1801 1802 1802 /* serialize file access (prevent writes) */ 1803 AutoRead erLock alock (this);1803 AutoReadLock alock (this); 1804 1804 1805 1805 try … … 1861 1861 1862 1862 /* serialize file access (prevent concurrent reads and writes) */ 1863 Auto Lock alock (this);1863 AutoWriteLock alock (this); 1864 1864 1865 1865 try … … 2103 2103 CheckComRCReturnRC (autoCaller.rc()); 2104 2104 2105 Auto Lock alock (this);2105 AutoWriteLock alock (this); 2106 2106 mData.mCallbacks.push_back (CallbackList::value_type (aCallback)); 2107 2107 … … 2122 2122 HRESULT rc = S_OK; 2123 2123 2124 Auto Lock alock (this);2124 AutoWriteLock alock (this); 2125 2125 2126 2126 CallbackList::iterator it; … … 2160 2160 2161 2161 /* saveSettings() needs write lock */ 2162 Auto Lock alock (this);2162 AutoWriteLock alock (this); 2163 2163 2164 2164 /* perform backup only when there was auto-conversion */ … … 2212 2212 AssertReturn (mAsyncEventQ, E_FAIL); 2213 2213 2214 Auto Lock alock (mAsyncEventQLock);2214 AutoWriteLock alock (mAsyncEventQLock); 2215 2215 if (mAsyncEventQ->postEvent (event)) 2216 2216 return S_OK; … … 2236 2236 CheckComRCReturnRC (autoCaller.rc()); 2237 2237 2238 Auto Lock alock (this);2238 AutoWriteLock alock (this); 2239 2239 mData.mProgressOperations.push_back (aProgress); 2240 2240 return S_OK; … … 2257 2257 ComPtr <IProgress> progress; 2258 2258 2259 Auto Lock alock (this);2259 AutoWriteLock alock (this); 2260 2260 2261 2261 for (ProgressList::iterator it = mData.mProgressOperations.begin(); … … 2549 2549 /// @todo (dmik) Win32? 2550 2550 #ifndef RT_OS_WINDOWS 2551 Auto Lock alock (this);2551 AutoWriteLock alock (this); 2552 2552 mWatcherData.mProcesses.push_back (pid); 2553 2553 #endif … … 2633 2633 CallbackList list; 2634 2634 { 2635 AutoRead erLock alock (this);2635 AutoReadLock alock (this); 2636 2636 list = mData.mCallbacks; 2637 2637 } … … 2796 2796 AssertComRCReturn (autoCaller.rc(), type); 2797 2797 2798 AutoRead erLock alock (this);2798 AutoReadLock alock (this); 2799 2799 2800 2800 /* unknown type must always be the first */ … … 2826 2826 2827 2827 { 2828 AutoRead erLock alock (this);2828 AutoReadLock alock (this); 2829 2829 2830 2830 for (MachineList::iterator it = mData.mMachines.begin(); … … 2874 2874 2875 2875 { 2876 AutoRead erLock alock (this);2876 AutoReadLock alock (this); 2877 2877 2878 2878 for (MachineList::const_iterator mit = mData.mMachines.begin(); … … 2961 2961 2962 2962 { 2963 AutoRead erLock alock (this);2963 AutoReadLock alock (this); 2964 2964 2965 2965 for (MachineList::const_iterator mit = mData.mMachines.begin(); … … 3077 3077 3078 3078 { 3079 AutoRead erLock alock (this);3079 AutoReadLock alock (this); 3080 3080 3081 3081 for (MachineList::iterator it = mData.mMachines.begin(); … … 3129 3129 ComAssertRet (aId || aLocation, E_INVALIDARG); 3130 3130 3131 AutoRead erLock alock (this);3131 AutoReadLock alock (this); 3132 3132 3133 3133 /* first lookup the map by UUID if UUID is provided */ … … 3154 3154 { 3155 3155 const ComObjPtr <HardDisk> &hd = (*it).second; 3156 AutoRead erLock hdLock (hd);3156 AutoReadLock hdLock (hd); 3157 3157 3158 3158 if (hd->storageType() == HardDiskStorageType_VirtualDiskImage || … … 3217 3217 ComAssertRet (aId || aFilePathFull, E_INVALIDARG); 3218 3218 3219 AutoRead erLock alock (this);3219 AutoReadLock alock (this); 3220 3220 3221 3221 /* first lookup the map by UUID if UUID is provided */ … … 3225 3225 if (it != mData.mHardDiskMap.end()) 3226 3226 { 3227 AutoRead erLock hdLock ((*it).second);3227 AutoReadLock hdLock ((*it).second); 3228 3228 if ((*it).second->storageType() == HardDiskStorageType_VirtualDiskImage) 3229 3229 { … … 3244 3244 { 3245 3245 const ComObjPtr <HardDisk> &hd = (*it).second; 3246 AutoRead erLock hdLock (hd);3246 AutoReadLock hdLock (hd); 3247 3247 if (hd->storageType() != HardDiskStorageType_VirtualDiskImage) 3248 3248 continue; … … 3300 3300 3301 3301 { 3302 AutoRead erLock alock (this);3302 AutoReadLock alock (this); 3303 3303 3304 3304 for (DVDImageList::const_iterator it = mData.mDVDImages.begin(); … … 3361 3361 3362 3362 { 3363 AutoRead erLock alock (this);3363 AutoReadLock alock (this); 3364 3364 3365 3365 for (FloppyImageList::iterator it = mData.mFloppyImages.begin(); … … 3422 3422 HRESULT rc = S_OK; 3423 3423 3424 AutoRead erLock alock (this);3424 AutoReadLock alock (this); 3425 3425 3426 3426 if (aHardDisk) … … 3716 3716 3717 3717 /* serialize file access (prevent concurrent reads and writes) */ 3718 Auto Lock alock (this);3718 AutoWriteLock alock (this); 3719 3719 3720 3720 try … … 3840 3840 HRESULT rc = S_OK; 3841 3841 3842 AutoRead erLock alock (this);3842 AutoReadLock alock (this); 3843 3843 3844 3844 for (HardDiskList::const_iterator it = mData.mHardDisks.begin(); … … 3847 3847 { 3848 3848 ComObjPtr <HardDisk> hd = *it; 3849 AutoRead erLock hdLock (hd);3849 AutoReadLock hdLock (hd); 3850 3850 3851 3851 Key hdNode = aNode.appendKey ("HardDisk"); … … 3916 3916 CheckComRCReturnRC (autoCaller.rc()); 3917 3917 3918 Auto Lock alock (this);3918 AutoWriteLock alock (this); 3919 3919 3920 3920 HRESULT rc = S_OK; … … 3969 3969 AssertComRCReturn (autoCaller.rc(), autoCaller.rc()); 3970 3970 3971 Auto Lock alock (this);3971 AutoWriteLock alock (this); 3972 3972 3973 3973 HRESULT rc = checkMediaForConflicts (aHardDisk, NULL, NULL); … … 4018 4018 LogFlowThisFunc (("image='%ls'\n", aHardDisk->toString().raw())); 4019 4019 4020 Auto Lock alock (this);4020 AutoWriteLock alock (this); 4021 4021 4022 4022 /* Lock the hard disk to ensure nobody registers it again before we delete 4023 4023 * the differencing image (sanity check actually -- should never happen). */ 4024 Auto Lock hdLock (aHardDisk);4024 AutoWriteLock hdLock (aHardDisk); 4025 4025 4026 4026 /* try to unregister */ … … 4077 4077 AssertComRCReturn (autoCaller.rc(), autoCaller.rc()); 4078 4078 4079 Auto Lock alock (this);4079 AutoWriteLock alock (this); 4080 4080 4081 4081 /* … … 4083 4083 * will be locked by #unregisterHardDisk(). 4084 4084 */ 4085 Auto Lock hdLock (aHardDisk);4085 AutoWriteLock hdLock (aHardDisk); 4086 4086 4087 4087 AssertReturn (aHardDisk->isDifferencing(), E_INVALIDARG); … … 4117 4117 AssertComRCReturn (autoCaller.rc(), autoCaller.rc()); 4118 4118 4119 Auto Lock alock (this);4119 AutoWriteLock alock (this); 4120 4120 4121 4121 size_t oldPathLen = strlen (aOldPath); … … 4409 4409 AssertComRCReturn (autoCaller.rc(), autoCaller.rc()); 4410 4410 4411 Auto Lock alock (this);4411 AutoWriteLock alock (this); 4412 4412 4413 4413 HRESULT rc = checkMediaForConflicts (NULL, &aImage->id(), … … 4442 4442 AssertComRCReturn (autoCaller.rc(), autoCaller.rc()); 4443 4443 4444 Auto Lock alock (this);4444 AutoWriteLock alock (this); 4445 4445 4446 4446 HRESULT rc = checkMediaForConflicts (NULL, &aImage->id(), … … 4771 4771 #ifdef DEBUG 4772 4772 { 4773 AutoRead erLock machieLock (machines [semId]);4773 AutoReadLock machieLock (machines [semId]); 4774 4774 LogFlowFunc (("released mutex: machine='%ls'\n", 4775 4775 machines [semId]->name().raw())); … … 4801 4801 #ifdef DEBUG 4802 4802 { 4803 AutoRead erLock machieLock (machines [semId]);4803 AutoReadLock machieLock (machines [semId]); 4804 4804 LogFlowFunc (("mutex owner dead: machine='%ls'\n", 4805 4805 machines [i]->name().raw())); … … 4900 4900 /* reap child processes */ 4901 4901 { 4902 Auto Lock alock (that);4902 AutoWriteLock alock (that); 4903 4903 if (that->mWatcherData.mProcesses.size()) 4904 4904 { … … 5015 5015 { 5016 5016 /* Make a copy to release the lock before iterating */ 5017 AutoRead erLock alock (mVirtualBox);5017 AutoReadLock alock (mVirtualBox); 5018 5018 callbacks = CallbackVector (mVirtualBox->mData.mCallbacks.begin(), 5019 5019 mVirtualBox->mData.mCallbacks.end()); -
trunk/src/VBox/Main/include/AudioAdapterImpl.h
r7207 r8083 90 90 HRESULT saveSettings (settings::Key &aMachineNode); 91 91 92 bool isModified() { Auto Lock alock (this); return mData.isBackedUp(); }93 bool isReallyModified() { Auto Lock alock (this); return mData.hasActualChanges(); }92 bool isModified() { AutoWriteLock alock (this); return mData.isBackedUp(); } 93 bool isReallyModified() { AutoWriteLock alock (this); return mData.hasActualChanges(); } 94 94 bool rollback(); 95 95 void commit(); -
trunk/src/VBox/Main/include/AutoLock.h
r7992 r8083 1 1 /** @file 2 2 * 3 * Auto Lock: smart critical section wrapper3 * AutoWriteLock/AutoReadLock: smart R/W semaphore wrappers 4 4 */ 5 5 … … 35 35 36 36 /** 37 * Abstract lock operations. See LockHandle and Auto Lock for details.37 * Abstract lock operations. See LockHandle and AutoWriteLock for details. 38 38 */ 39 39 class LockOps … … 48 48 49 49 /** 50 * Read lock operations. See LockHandle and Auto Lock for details.50 * Read lock operations. See LockHandle and AutoWriteLock for details. 51 51 */ 52 52 class ReadLockOps : public LockOps … … 70 70 71 71 /** 72 * Write lock operations. See LockHandle and Auto Lock for details.72 * Write lock operations. See LockHandle and AutoWriteLock for details. 73 73 */ 74 74 class WriteLockOps : public LockOps … … 98 98 * with pure methods of ReadLockOps and WriteLockOps classes. 99 99 * 100 * See the Auto Lock class documentation for the detailed description of read and101 * write locks.100 * See the AutoWriteLock class documentation for the detailed description of 101 * read and write locks. 102 102 */ 103 103 class LockHandle : protected ReadLockOps, protected WriteLockOps … … 112 112 * read/write semaphore. Intended for debugging only. 113 113 */ 114 virtual bool is LockedOnCurrentThread() const = 0;114 virtual bool isWriteLockOnCurrentThread() const = 0; 115 115 116 116 /** … … 140 140 DECLARE_CLS_COPY_CTOR_ASSIGN_NOOP (LockHandle) 141 141 142 friend class Auto Lock;143 friend class AutoRead erLock;142 friend class AutoWriteLock; 143 friend class AutoReadLock; 144 144 }; 145 145 … … 148 148 * 149 149 * This is an auxiliary base class for classes that need full-featured 150 * read/write locking as described in the Auto Lock class documentation.150 * read/write locking as described in the AutoWriteLock class documentation. 151 151 * Instances of classes inherited from this class can be passed as arguments to 152 * the Auto Lock and AutoReaderLock constructors.152 * the AutoWriteLock and AutoReadLock constructors. 153 153 */ 154 154 class RWLockHandle : public LockHandle … … 159 159 virtual ~RWLockHandle(); 160 160 161 bool is LockedOnCurrentThread() const;161 bool isWriteLockOnCurrentThread() const; 162 162 163 163 private: … … 191 191 * which makes a lockRead() call fully equivalent to the lockWrite() call and 192 192 * therefore makes it pointless to use instahces of this class with 193 * AutoRead erLock instances -- shared locking will not be possible anyway and193 * AutoReadLock instances -- shared locking will not be possible anyway and 194 194 * any call to lock() will block if there are lock owners on other threads. 195 195 * … … 210 210 } 211 211 212 bool is LockedOnCurrentThread() const212 bool isWriteLockOnCurrentThread() const 213 213 { 214 214 return RTCritSectIsOwner (&mCritSect); … … 259 259 260 260 /** 261 * Returns a pointer to a LockHandle used by Auto Lock/AutoReaderLock for262 * locking. Subclasses are allowed to return @c NULL -- in this case,263 * the Auto Lock/AutoReaderLock object constructed using an instance of261 * Returns a pointer to a LockHandle used by AutoWriteLock/AutoReadLock 262 * for locking. Subclasses are allowed to return @c NULL -- in this case, 263 * the AutoWriteLock/AutoReadLock object constructed using an instance of 264 264 * such subclass will simply turn into no-op. 265 265 */ … … 267 267 268 268 /** 269 * Equivalent to <tt>#lockHandle()->is LockedOnCurrentThread()</tt>.269 * Equivalent to <tt>#lockHandle()->isWriteLockOnCurrentThread()</tt>. 270 270 * Returns @c false if lockHandle() returns @c NULL. 271 271 */ 272 bool is LockedOnCurrentThread()272 bool isWriteLockOnCurrentThread() 273 273 { 274 274 LockHandle *h = lockHandle(); 275 return h ? h->is LockedOnCurrentThread() : false;275 return h ? h->isWriteLockOnCurrentThread() : false; 276 276 } 277 277 … … 329 329 * <b>deadlock</b> (i.e. it will block forever waiting for itself). 330 330 * 331 * Note that instances of the Auto Lock class manage write locks of read/write332 * semaphores only. In order to manage read locks, please use the AutoReaderLock333 * class.331 * Note that instances of the AutoWriteLock class manage write locks of 332 * read/write semaphores only. In order to manage read locks, please use the 333 * AutoReadLock class. 334 334 * 335 335 * Safe semaphore management consists of the following: 336 336 * <ul> 337 * <li>When an instance of the Auto Lock class is constructed given a valid338 * semaphore handle, it will automatically request a write lock on that337 * <li>When an instance of the AutoWriteLock class is constructed given a 338 * valid semaphore handle, it will automatically request a write lock on that 339 339 * semaphore. 340 340 * </li> 341 * <li>When an instance of the Auto Lock class constructed given a valid341 * <li>When an instance of the AutoWriteLock class constructed given a valid 342 342 * semaphore handle is destroyed (e.g. goes out of scope), it will 343 343 * automatically release the write lock that was requested upon construction 344 344 * and also all nested write locks requested later using the #lock() call 345 345 * (note that the latter is considered to be a program logic error, see the 346 * #~Auto Lock() description for details).346 * #~AutoWriteLock() description for details). 347 347 * </li> 348 348 * </ul> 349 349 * 350 * Note that the LockHandle class taken by Auto Lock constructors is an abstract351 * base of the read/write semaphore. You should choose one of the existing352 * subclasses of this abstract class or create your own subclass that implements353 * necessary read and write lock semantics. The most suitable choice is the354 * RWLockHandle class which provides full support for both read and write locks355 * as describerd above. Alternatively, you can use the WriteLockHandle class if356 * you only need write (exclusive) locking (WriteLockHandle requires less system357 * resources and works faster).358 * 359 * A typical usage pattern of the Auto Lock class is as follows:350 * Note that the LockHandle class taken by AutoWriteLock constructors is an 351 * abstract base of the read/write semaphore. You should choose one of the 352 * existing subclasses of this abstract class or create your own subclass that 353 * implements necessary read and write lock semantics. The most suitable choice 354 * is the RWLockHandle class which provides full support for both read and write 355 * locks as describerd above. Alternatively, you can use the WriteLockHandle 356 * class if you only need write (exclusive) locking (WriteLockHandle requires 357 * less system resources and works faster). 358 * 359 * A typical usage pattern of the AutoWriteLock class is as follows: 360 360 * <code> 361 361 * struct Struct : public RWLockHandle … … 368 368 * { 369 369 * // acquire a write lock of aStruct 370 * Auto Lock alock (aStruct);370 * AutoWriteLock alock (aStruct); 371 371 * 372 372 * // now we can modify aStruct in a thread-safe manner … … 393 393 * <code> 394 394 * Thread 1: 395 * #1: Auto Lock (mFoo);395 * #1: AutoWriteLock (mFoo); 396 396 * ... 397 * #2: Auto Lock (mBar);397 * #2: AutoWriteLock (mBar); 398 398 * ... 399 399 * Thread 2: 400 * #3: Auto Lock (mBar);400 * #3: AutoWriteLock (mBar); 401 401 * ... 402 * #4: Auto Lock (mFoo);402 * #4: AutoWriteLock (mFoo); 403 403 * ... 404 404 * </code> … … 425 425 * whole application so the human factor applies. Taking the simplicity of this 426 426 * method into account, it is chosen to solve potential deadlock problems when 427 * using Auto Lock and AutoReaderLock classes. Here are the locking rules that428 * must be obeyed by <b>all</b> users of these classes. Note that if more than429 * one rule matches the given group of objects to lock, all of these rules must430 * be met:427 * using AutoWriteLock and AutoReadLock classes. Here are the locking rules 428 * that must be obeyed by <b>all</b> users of these classes. Note that if more 429 * than one rule matches the given group of objects to lock, all of these rules 430 * must be met: 431 431 * <ol> 432 432 * <li>If there is a parent-child (or master-slave) relationship between the … … 455 455 * per every object). 456 456 */ 457 class Auto Lock457 class AutoWriteLock 458 458 { 459 459 public: … … 467 467 * runtime. 468 468 */ 469 Auto Lock() : mHandle (NULL), mLockLevel (0), mGlobalLockLevel (0) {}469 AutoWriteLock() : mHandle (NULL), mLockLevel (0), mGlobalLockLevel (0) {} 470 470 471 471 /** … … 473 473 * semaphore by requesting a write lock. 474 474 */ 475 Auto Lock (LockHandle *aHandle)475 AutoWriteLock (LockHandle *aHandle) 476 476 : mHandle (aHandle), mLockLevel (0), mGlobalLockLevel (0) 477 477 { lock(); } … … 481 481 * semaphore by requesting a write lock. 482 482 */ 483 Auto Lock (LockHandle &aHandle)483 AutoWriteLock (LockHandle &aHandle) 484 484 : mHandle (&aHandle), mLockLevel (0), mGlobalLockLevel (0) 485 485 { lock(); } … … 489 489 * semaphore by requesting a write lock. 490 490 */ 491 Auto Lock (const Lockable &aLockable)491 AutoWriteLock (const Lockable &aLockable) 492 492 : mHandle (aLockable.lockHandle()), mLockLevel (0), mGlobalLockLevel (0) 493 493 { lock(); } … … 497 497 * semaphore by requesting a write lock. 498 498 */ 499 Auto Lock (const Lockable *aLockable)499 AutoWriteLock (const Lockable *aLockable) 500 500 : mHandle (aLockable ? aLockable->lockHandle() : NULL) 501 501 , mLockLevel (0), mGlobalLockLevel (0) … … 511 511 * is a program logic error which must be fixed. 512 512 */ 513 ~Auto Lock()513 ~AutoWriteLock() 514 514 { 515 515 if (mHandle) … … 568 568 * This implies that all nested write locks on the semaphore will be 569 569 * released, even those that were acquired through the calls to #lock() 570 * methods of all other Auto Lock/AutoReaderLock instances managing the570 * methods of all other AutoWriteLock/AutoReadLock instances managing the 571 571 * <b>same</b> read/write semaphore. 572 572 * … … 579 579 * called minus the number of nested #lock() calls made on this instance 580 580 * itself. This is done to preserve lock levels of other 581 * Auto Lock/AutoReaderLock instances managing the same semaphore (if any).582 * Tiis also means that the destructor may indefinitely block if a write or583 * a read lock is owned by some other thread by that time.581 * AutoWriteLock/AutoReadLock instances managing the same semaphore (if 582 * any). Tiis also means that the destructor may indefinitely block if a 583 * write or a read lock is owned by some other thread by that time. 584 584 */ 585 585 void leave() … … 627 627 * @note Intended for debugging only. 628 628 */ 629 bool is LockedOnCurrentThread() const630 { 631 return mHandle ? mHandle->is LockedOnCurrentThread() : false;629 bool isWriteLockOnCurrentThread() const 630 { 631 return mHandle ? mHandle->isWriteLockOnCurrentThread() : false; 632 632 } 633 633 … … 684 684 private: 685 685 686 DECLARE_CLS_COPY_CTOR_ASSIGN_NOOP (Auto Lock)687 DECLARE_CLS_NEW_DELETE_NOOP (Auto Lock)686 DECLARE_CLS_COPY_CTOR_ASSIGN_NOOP (AutoWriteLock) 687 DECLARE_CLS_NEW_DELETE_NOOP (AutoWriteLock) 688 688 689 689 LockHandle *mHandle; … … 699 699 * Provides safe management of read/write semaphores in read mode. 700 700 * 701 * This class differs from the Auto Lock class is so that it's #lock() and701 * This class differs from the AutoWriteLock class is so that it's #lock() and 702 702 * #unlock() methods requests and release read (shared) locks on the managed 703 * read/write semaphore instead of write (exclusive) locks. See the AutoLock 704 * class description for more information about read and write locks. 703 * read/write semaphore instead of write (exclusive) locks. See the 704 * AutoWriteLock class description for more information about read and write 705 * locks. 705 706 * 706 707 * Safe semaphore management consists of the following: 707 708 * <ul> 708 * <li>When an instance of the AutoRead erLock class is constructed given a709 * <li>When an instance of the AutoReadLock class is constructed given a 709 710 * valid semaphore handle, it will automatically request a read lock on that 710 711 * semaphore. 711 712 * </li> 712 * <li>When an instance of the AutoRead erLock class constructed given a valid713 * <li>When an instance of the AutoReadLock class constructed given a valid 713 714 * semaphore handle is destroyed (e.g. goes out of scope), it will 714 715 * automatically release the read lock that was requested upon construction 715 716 * and also all nested read locks requested later using the #lock() call (note 716 717 * that the latter is considered to be a program logic error, see the 717 * #~AutoRead erLock() description for details).718 * #~AutoReadLock() description for details). 718 719 * </li> 719 720 * </ul> 720 721 * 721 * Note that the LockHandle class taken by AutoRead erLock constructors is an722 * Note that the LockHandle class taken by AutoReadLock constructors is an 722 723 * abstract base of the read/write semaphore. You should choose one of the 723 724 * existing subclasses of this abstract class or create your own subclass that 724 725 * implements necessary read and write lock semantics. The most suitable choice 725 726 * is the RWLockHandle class which provides full support for both read and write 726 * locks as describerd in Auto Lock docs. Alternatively, you can use the727 * locks as describerd in AutoWriteLock docs. Alternatively, you can use the 727 728 * WriteLockHandle class if you only need write (exclusive) locking 728 729 * (WriteLockHandle requires less system resources and works faster). 729 730 * 730 731 * However, please note that it absolutely does not make sense to manage 731 * WriteLockHandle semaphores with AutoRead erLock instances because732 * AutoRead erLock instances will behave like AutoLock instances in this case733 * since WriteLockHandle provides only exclusive write locking. You have been734 * warned.735 736 * A typical usage pattern of the AutoRead erLock class is as follows:732 * WriteLockHandle semaphores with AutoReadLock instances because 733 * AutoReadLock instances will behave like AutoWriteLock instances in this 734 * case since WriteLockHandle provides only exclusive write locking. You have 735 * been warned. 736 737 * A typical usage pattern of the AutoReadLock class is as follows: 737 738 * <code> 738 739 * struct Struct : public RWLockHandle … … 746 747 * // acquire a read lock of aStruct (note that two foo() calls may be 747 748 * executed on separate threads simultaneously w/o blocking each other) 748 * AutoRead erLock alock (aStruct);749 * AutoReadLock alock (aStruct); 749 750 * 750 751 * // now we can read aStruct in a thread-safe manner … … 764 765 * </code> 765 766 */ 766 class AutoRead erLock767 class AutoReadLock 767 768 { 768 769 public: … … 776 777 * runtime. 777 778 */ 778 AutoRead erLock() : mHandle (NULL), mLockLevel (0) {}779 AutoReadLock() : mHandle (NULL), mLockLevel (0) {} 779 780 780 781 /** … … 782 783 * semaphore by requesting a read lock. 783 784 */ 784 AutoRead erLock (LockHandle *aHandle)785 AutoReadLock (LockHandle *aHandle) 785 786 : mHandle (aHandle), mLockLevel (0) 786 787 { lock(); } … … 790 791 * semaphore by requesting a read lock. 791 792 */ 792 AutoRead erLock (LockHandle &aHandle)793 AutoReadLock (LockHandle &aHandle) 793 794 : mHandle (&aHandle), mLockLevel (0) 794 795 { lock(); } … … 798 799 * semaphore by requesting a read lock. 799 800 */ 800 AutoRead erLock (const Lockable &aLockable)801 AutoReadLock (const Lockable &aLockable) 801 802 : mHandle (aLockable.lockHandle()), mLockLevel (0) 802 803 { lock(); } … … 806 807 * semaphore by requesting a read lock. 807 808 */ 808 AutoRead erLock (const Lockable *aLockable)809 AutoReadLock (const Lockable *aLockable) 809 810 : mHandle (aLockable ? aLockable->lockHandle() : NULL) 810 811 , mLockLevel (0) … … 820 821 * is a program logic error which must be fixed. 821 822 */ 822 ~AutoRead erLock()823 ~AutoReadLock() 823 824 { 824 825 if (mHandle) … … 908 909 private: 909 910 910 DECLARE_CLS_COPY_CTOR_ASSIGN_NOOP (AutoRead erLock)911 DECLARE_CLS_NEW_DELETE_NOOP (AutoRead erLock)911 DECLARE_CLS_COPY_CTOR_ASSIGN_NOOP (AutoReadLock) 912 DECLARE_CLS_NEW_DELETE_NOOP (AutoReadLock) 912 913 913 914 LockHandle *mHandle; … … 1030 1031 * AutoMultiLock2 multiLock (data1.wlock(), data2.rlock()); 1031 1032 * // both locks are held here: 1032 * // - data1 is locked in write mode (like Auto Lock)1033 * // - data2 is locked in read mode (like AutoRead erLock)1033 * // - data1 is locked in write mode (like AutoWriteLock) 1034 * // - data2 is locked in read mode (like AutoReadLock) 1034 1035 * } 1035 1036 * // both locks are released here … … 1075 1076 1076 1077 /** 1077 * Calls Auto Lock::lock() methods for all managed semaphore handles in order1078 * they were passed to the constructor.1078 * Calls AutoWriteLock::lock() methods for all managed semaphore handles in 1079 * order they were passed to the constructor. 1079 1080 */ 1080 1081 void lock() … … 1086 1087 1087 1088 /** 1088 * Calls Auto Lock::unlock() methods for all managed semaphore handles in1089 * reverse to the order they were passed to the constructor.1089 * Calls AutoWriteLock::unlock() methods for all managed semaphore handles 1090 * in reverse to the order they were passed to the constructor. 1090 1091 */ 1091 1092 void unlock() … … 1099 1100 1100 1101 /** 1101 * Calls Auto Lock::leave() methods for all managed semaphore handles in1102 * Calls AutoWriteLock::leave() methods for all managed semaphore handles in 1102 1103 * reverse to the order they were passed to the constructor. 1103 1104 */ … … 1112 1113 1113 1114 /** 1114 * Calls Auto Lock::enter() methods for all managed semaphore handles in order1115 * they were passed to the constructor.1115 * Calls AutoWriteLock::enter() methods for all managed semaphore handles in 1116 * order they were passed to the constructor. 1116 1117 */ 1117 1118 void enter() … … 1131 1132 private: 1132 1133 1133 Auto Lock mLocks [Cnt];1134 AutoWriteLock mLocks [Cnt]; 1134 1135 1135 1136 DECLARE_CLS_COPY_CTOR_ASSIGN_NOOP (AutoMultiWriteLockBase) -
trunk/src/VBox/Main/include/BIOSSettingsImpl.h
r7207 r8083 123 123 const Backupable <Data> &data() const { return mData; } 124 124 125 bool isModified() { Auto Lock alock (this); return mData.isBackedUp(); }126 bool isReallyModified() { Auto Lock alock (this); return mData.hasActualChanges(); }127 void rollback() { Auto Lock alock (this); mData.rollback(); }125 bool isModified() { AutoWriteLock alock (this); return mData.isBackedUp(); } 126 bool isReallyModified() { AutoWriteLock alock (this); return mData.hasActualChanges(); } 127 void rollback() { AutoWriteLock alock (this); mData.rollback(); } 128 128 void commit(); 129 129 void copyFrom (BIOSSettings *aThat); -
trunk/src/VBox/Main/include/DVDDriveImpl.h
r6076 r8083 95 95 HRESULT saveSettings (settings::Key &aMachineNode); 96 96 97 bool isModified() { Auto Lock alock (this); return mData.isBackedUp(); }98 bool isReallyModified() { Auto Lock alock (this); return mData.hasActualChanges(); }97 bool isModified() { AutoWriteLock alock (this); return mData.isBackedUp(); } 98 bool isReallyModified() { AutoWriteLock alock (this); return mData.hasActualChanges(); } 99 99 bool rollback(); 100 100 void commit(); -
trunk/src/VBox/Main/include/FloppyDriveImpl.h
r6076 r8083 96 96 HRESULT saveSettings (settings::Key &aMachineNode); 97 97 98 bool isModified() { Auto Lock alock (this); return mData.isBackedUp(); }99 bool isReallyModified() { Auto Lock alock (this); return mData.hasActualChanges(); }98 bool isModified() { AutoWriteLock alock (this); return mData.isBackedUp(); } 99 bool isReallyModified() { AutoWriteLock alock (this); return mData.hasActualChanges(); } 100 100 bool rollback(); 101 101 void commit(); -
trunk/src/VBox/Main/include/HardDiskImpl.h
r7992 r8083 66 66 // protected initializer/uninitializer for internal purposes only 67 67 HRESULT protectedInit (VirtualBox *aVirtualBox, HardDisk *aParent); 68 void protectedUninit (Auto Lock &alock);68 void protectedUninit (AutoWriteLock &alock); 69 69 70 70 public: … … 108 108 bool isParentImmutable() const 109 109 { 110 Auto Lock parentLock (mParent);110 AutoWriteLock parentLock (mParent); 111 111 return !mParent.isNull() && mParent->type() == HardDiskType_Immutable; 112 112 } … … 121 121 /** 122 122 * Shortcut to #dependentChildren(). 123 * Do |Auto Lock alock (childrenLock());| before acceessing the returned list!123 * Do |AutoWriteLock alock (childrenLock());| before acceessing the returned list! 124 124 */ 125 125 const HardDiskList &children() const { return dependentChildren(); } … … 169 169 170 170 /* the following must be called from under the lock */ 171 bool isBusy() { is LockedOnCurrentThread(); return mBusy; }172 unsigned readers() { is LockedOnCurrentThread(); return mReaders; }171 bool isBusy() { isWriteLockOnCurrentThread(); return mBusy; } 172 unsigned readers() { isWriteLockOnCurrentThread(); return mReaders; } 173 173 const Bstr &lastAccessError() const { return mLastAccessError; } 174 174 -
trunk/src/VBox/Main/include/MachineImpl.h
r7992 r8083 591 591 bool aSetError = false) 592 592 { 593 Auto Lock alock (this);593 AutoWriteLock alock (this); 594 594 return findSharedFolder (aName, aSharedFolder, aSetError); 595 595 } … … 616 616 void uninitDataAndChildObjects(); 617 617 618 void ensureNoStateDependencies (Auto Lock &aLock);618 void ensureNoStateDependencies (AutoWriteLock &aLock); 619 619 620 620 virtual HRESULT setMachineState (MachineState_T aMachineState); -
trunk/src/VBox/Main/include/NetworkAdapterImpl.h
r7207 r8083 151 151 HRESULT saveSettings (settings::Key &aAdapterNode); 152 152 153 bool isModified() { Auto Lock alock (this); return mData.isBackedUp(); }154 bool isReallyModified() { Auto Lock alock (this); return mData.hasActualChanges(); }153 bool isModified() { AutoWriteLock alock (this); return mData.isBackedUp(); } 154 bool isReallyModified() { AutoWriteLock alock (this); return mData.hasActualChanges(); } 155 155 bool rollback(); 156 156 void commit(); -
trunk/src/VBox/Main/include/ParallelPortImpl.h
r6168 r8083 98 98 HRESULT saveSettings (settings::Key &aPortNode); 99 99 100 bool isModified() { Auto Lock alock (this); return mData.isBackedUp(); }101 bool isReallyModified() { Auto Lock alock (this); return mData.hasActualChanges(); }100 bool isModified() { AutoWriteLock alock (this); return mData.isBackedUp(); } 101 bool isReallyModified() { AutoWriteLock alock (this); return mData.hasActualChanges(); } 102 102 bool rollback(); 103 103 void commit(); -
trunk/src/VBox/Main/include/ProgressImpl.h
r5999 r8083 53 53 const BSTR aDescription, GUIDPARAMOUT aId = NULL); 54 54 HRESULT protectedInit(); 55 void protectedUninit (Auto Lock &alock);55 void protectedUninit (AutoWriteLock &alock); 56 56 57 57 public: … … 76 76 // public methods only for internal purposes 77 77 78 Guid id() { Auto Lock alock (this); return mId; }79 BOOL completed() { Auto Lock alock (this); return mCompleted; }80 HRESULT resultCode() { Auto Lock alock (this); return mResultCode; }78 Guid id() { AutoWriteLock alock (this); return mId; } 79 BOOL completed() { AutoWriteLock alock (this); return mCompleted; } 80 HRESULT resultCode() { AutoWriteLock alock (this); return mResultCode; } 81 81 82 82 // for VirtualBoxSupportErrorInfoImpl … … 259 259 GUIDPARAMOUT aId = NULL) 260 260 { 261 Auto Locklock (this);261 AutoWriteLock alock (this); 262 262 ComAssertRet (!isReady(), E_UNEXPECTED); 263 263 … … 283 283 GUIDPARAMOUT aId = NULL) 284 284 { 285 Auto Locklock (this);285 AutoWriteLock alock (this); 286 286 ComAssertRet (!isReady(), E_UNEXPECTED); 287 287 -
trunk/src/VBox/Main/include/SerialPortImpl.h
r7207 r8083 109 109 HRESULT saveSettings (settings::Key &aPortNode); 110 110 111 bool isModified() { Auto Lock alock (this); return mData.isBackedUp(); }112 bool isReallyModified() { Auto Lock alock (this); return mData.hasActualChanges(); }111 bool isModified() { AutoWriteLock alock (this); return mData.isBackedUp(); } 112 bool isReallyModified() { AutoWriteLock alock (this); return mData.hasActualChanges(); } 113 113 bool rollback(); 114 114 void commit(); -
trunk/src/VBox/Main/include/Shareable.h
r5999 r8083 92 92 * 93 93 * This template class is NOT thread-safe. If you need thread safefy, you can 94 * specify AutoLock::Lockable as the second argument to the template. In this 95 * case, you can explicitly lock instances of the template (using the AutoLock 96 * and AutoReaderLock classes) before accessing any of its members, as follows: 94 * specify util::Lockable as the second argument to the template. In this 95 * case, you can explicitly lock instances of the template (using the 96 * AutoWriteLock and AutoReadLock classes) before accessing any of its 97 * members, as follows: 97 98 * <code> 98 99 * struct Data { ... }; 99 * Shareable <Data, AutoLock::Lockable> mData;100 * Shareable <Data, util::Lockable> mData; 100 101 * ... 101 102 * { 102 103 * // acquire the lock until the end of the block 103 * Auto Locklock (mData);104 * AutoWriteLock alock (mData); 104 105 * // share with another instance (thatData defined somewhere else) 105 106 * { 106 * AutoRead erLock thatLock (thatData);107 * AutoReadLock thatLock (thatData); 107 108 * mData = thatData; 108 109 * } … … 117 118 * Shareable instance will prevent another one sharing the same data from 118 119 * accessing it). This can be done in a similar way by deriving the data 119 * structure to manage from AutoLock::Lockable and using the #data() method to120 * structure to manage from util::Lockable and using the #data() method to 120 121 * lock it before accessing: 121 122 * <code> 122 * struct Data : public AutoLock::Lockable { ... };123 * Shareable <Data, AutoLock::Lockable> mData;123 * struct Data : public util::Lockable { ... }; 124 * Shareable <Data, util::Lockable> mData; 124 125 * ... 125 126 * { 126 127 * // read-only data access 127 * AutoRead erLock lock (mData); // protect Shareable members (read-only)128 * AutoRead erLock dataLock (mData.data()); // protect Data members (read-only)128 * AutoReadLock lock (mData); // protect Shareable members (read-only) 129 * AutoReadLock dataLock (mData.data()); // protect Data members (read-only) 129 130 * if (mData->mSomeVield) ... 130 131 * } … … 132 133 * { 133 134 * // data modification 134 * AutoRead erLock lock (mData); // protect Shareable members (still read-only)135 * Auto Lock dataLock (mData.data()); // protect Data members (exclusive)135 * AutoReadLock lock (mData); // protect Shareable members (still read-only) 136 * AutoWriteLock dataLock (mData.data()); // protect Data members (exclusive) 136 137 * mData->mSomeVield = someValue; 137 138 * } … … 284 285 * template are appliable to this class as well. In particular, all new methods 285 286 * of this template are not implicitly thread-safe, so if you add thread 286 * safety using the AutoLock::Lockable class, don't forget to lock the287 * safety using the util::Lockable class, don't forget to lock the 287 288 * Backupable instance before doing #backup(), #commit() or #rollback(). 288 289 * -
trunk/src/VBox/Main/include/SnapshotImpl.h
r7992 r8083 89 89 // public methods only for internal purposes 90 90 91 /** Do |Auto Lock alock (this);| before acceessing the returned data! */91 /** Do |AutoWriteLock alock (this);| before acceessing the returned data! */ 92 92 const Data &data() const { return mData; } 93 93 … … 101 101 /** 102 102 * Shortcut to #dependentChildren(). 103 * Do |Auto Lock alock (childrenLock());| before acceessing the returned list!103 * Do |AutoWriteLock alock (childrenLock());| before acceessing the returned list! 104 104 */ 105 105 const SnapshotList &children() const { return dependentChildren(); } -
trunk/src/VBox/Main/include/VRDPServerImpl.h
r6076 r8083 101 101 HRESULT saveSettings (settings::Key &aMachineNode); 102 102 103 bool isModified() { Auto Lock alock (this); return mData.isBackedUp(); }104 bool isReallyModified() { Auto Lock alock (this); return mData.hasActualChanges(); }103 bool isModified() { AutoWriteLock alock (this); return mData.isBackedUp(); } 104 bool isReallyModified() { AutoWriteLock alock (this); return mData.hasActualChanges(); } 105 105 bool rollback(); 106 106 void commit(); -
trunk/src/VBox/Main/include/VirtualBoxBase.h
r7992 r8083 449 449 public: 450 450 451 // AutoLock::Lockable interface451 // util::Lockable interface 452 452 virtual RWLockHandle *lockHandle() const; 453 453 … … 1664 1664 // child's uninit() from under the children map lock should not produce 1665 1665 // dead-locks any more). 1666 Assert (!child->is LockedOnCurrentThread());1666 Assert (!child->isWriteLockOnCurrentThread()); 1667 1667 removeDependentChild (ComPtr <IUnknown> (child)); 1668 1668 } … … 1798 1798 { 1799 1799 AssertReturnVoid (aChild); 1800 Assert (!aChild->is LockedOnCurrentThread());1800 Assert (!aChild->isWriteLockOnCurrentThread()); 1801 1801 doRemoveDependentChild (ComPtr <IUnknown> (aChild)); 1802 1802 } … … 1875 1875 AssertReturn (child, (void) 0); 1876 1876 1877 Auto Lock alock (mMapLock);1877 AutoWriteLock alock (mMapLock); 1878 1878 if (mInUninit) 1879 1879 return; … … 1894 1894 AssertReturn (child, (void) 0); 1895 1895 1896 Auto Lock alock (mMapLock);1896 AutoWriteLock alock (mMapLock); 1897 1897 if (mInUninit) 1898 1898 return; … … 1905 1905 /** 1906 1906 * Returns an internal lock handle to lock the list of children 1907 * returned by #dependentChildren() using Auto Lock:1907 * returned by #dependentChildren() using AutoWriteLock: 1908 1908 * <code> 1909 * Auto Lock alock (dependentChildrenLock());1909 * AutoWriteLock alock (dependentChildrenLock()); 1910 1910 * </code> 1911 1911 */ … … 1916 1916 * @note 1917 1917 * Access the returned list (iterate, get size etc.) only after 1918 * doing |Auto Lock alock (dependentChildrenLock());|!1918 * doing |AutoWriteLock alock (dependentChildrenLock());|! 1919 1919 */ 1920 1920 const DependentChildren &dependentChildren() const { return mDependentChildren; } … … 1932 1932 void uninitDependentChildren() 1933 1933 { 1934 Auto Lock alock (this);1935 Auto Lock mapLock (mMapLock);1934 AutoWriteLock alock (this); 1935 AutoWriteLock mapLock (mMapLock); 1936 1936 1937 1937 if (mDependentChildren.size()) … … 1969 1969 void removeDependentChildren() 1970 1970 { 1971 Auto Lock alock (mMapLock);1971 AutoWriteLock alock (mMapLock); 1972 1972 mDependentChildren.clear(); 1973 1973 } … … 2029 2029 AssertReturnVoid (aChild); 2030 2030 2031 Auto Lock alock (mMapLock);2031 AutoWriteLock alock (mMapLock); 2032 2032 if (mInUninit) 2033 2033 return; … … 2049 2049 AssertReturnVoid (aChild); 2050 2050 2051 Auto Lock alock (mMapLock);2051 AutoWriteLock alock (mMapLock); 2052 2052 if (mInUninit) 2053 2053 return; … … 2060 2060 /** 2061 2061 * Returns an internal lock handle used to lock the list of children 2062 * returned by #dependentChildren(). This lock is to be used by AutoLock as2063 * follows:2062 * returned by #dependentChildren(). This lock is to be used by 2063 * AutoWriteLock as follows: 2064 2064 * <code> 2065 * Auto Lock alock (dependentChildrenLock());2065 * AutoWriteLock alock (dependentChildrenLock()); 2066 2066 * </code> 2067 2067 */ … … 2072 2072 * 2073 2073 * @note Access the returned list (iterate, get size etc.) only after doing 2074 * Auto Lock alock (dependentChildrenLock())!2074 * AutoWriteLock alock (dependentChildrenLock())! 2075 2075 */ 2076 2076 const DependentChildren &dependentChildren() const { return mDependentChildren; } … … 2087 2087 { 2088 2088 /// @todo why?.. 2089 AssertReturnVoid (is LockedOnCurrentThread());2090 2091 Auto Lock alock (mMapLock);2089 AssertReturnVoid (isWriteLockOnCurrentThread()); 2090 2091 AutoWriteLock alock (mMapLock); 2092 2092 mDependentChildren.clear(); 2093 2093 }
Note:
See TracChangeset
for help on using the changeset viewer.