Changeset 40257 in vbox for trunk/src/VBox/Main/src-client
- Timestamp:
- Feb 27, 2012 9:25:12 AM (13 years ago)
- Location:
- trunk/src/VBox/Main/src-client
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/src-client/ConsoleImpl.cpp
r40084 r40257 2077 2077 return ptrVM.rc(); 2078 2078 2079 /* leave the lock before a VMR3* call (EMT will call us back)! */2080 alock. leave();2079 /* release the lock before a VMR3* call (EMT will call us back)! */ 2080 alock.release(); 2081 2081 2082 2082 int vrc = VMR3Reset(ptrVM); … … 2290 2290 this, pVM, aCpu); 2291 2291 2292 /* leave the lock before a VMR3* call (EMT will call us back)! */2292 /* release the lock before a VMR3* call (EMT will call us back)! */ 2293 2293 alock.release(); 2294 2294 … … 2354 2354 LogFlowThisFunc(("Sending PAUSE request...\n")); 2355 2355 2356 /* leave the lock before a VMR3* call (EMT will call us back)! */2357 alock. leave();2356 /* release the lock before a VMR3* call (EMT will call us back)! */ 2357 alock.release(); 2358 2358 2359 2359 int vrc = VMR3Suspend(ptrVM); … … 2389 2389 LogFlowThisFunc(("Sending RESUME request...\n")); 2390 2390 2391 /* leave the lock before a VMR3* call (EMT will call us back)! */2392 alock. leave();2391 /* release the lock before a VMR3* call (EMT will call us back)! */ 2392 alock.release(); 2393 2393 2394 2394 #ifdef VBOX_WITH_EXTPACK … … 2434 2434 if (!ptrVM.isOk()) 2435 2435 return ptrVM.rc(); 2436 /** @todo leave the console lock? */ 2436 2437 /** @todo release the console lock? */ 2437 2438 2438 2439 /* get the acpi device interface and press the button. */ … … 2481 2482 if (!ptrVM.isOk()) 2482 2483 return ptrVM.rc(); 2483 /** @todo leave the console lock? */ 2484 2485 /** @todo release the console lock? */ 2484 2486 2485 2487 /* get the acpi device interface and check if the button press was handled. */ … … 2536 2538 return ptrVM.rc(); 2537 2539 2538 /** @todo leave the console lock? */2540 /** @todo release the console lock? */ 2539 2541 2540 2542 /* get the acpi device interface and query the information. */ … … 2577 2579 return ptrVM.rc(); 2578 2580 2579 /** @todo leave the console lock? */2581 /** @todo release the console lock? */ 2580 2582 2581 2583 /* get the acpi device interface and press the sleep button. */ … … 2679 2681 /* 2680 2682 * If we fail here it means a PowerDown() call happened on another 2681 * thread while we were doing Pause() (which leaves the Console lock).2683 * thread while we were doing Pause() (which releases the Console lock). 2682 2684 * We assign PowerDown() a higher precedence than SaveState(), 2683 2685 * therefore just return the error to the caller. … … 2887 2889 tr("The virtual machine does not have a USB controller")); 2888 2890 2889 /* leave the lock because the USB Proxy service may call us back2891 /* release the lock because the USB Proxy service may call us back 2890 2892 * (via onUSBDeviceAttach()) */ 2891 alock. leave();2893 alock.release(); 2892 2894 2893 2895 /* Request the device capture */ … … 2932 2934 * Inform the USB device and USB proxy about what's cooking. 2933 2935 */ 2934 alock. leave();2936 alock.release(); 2935 2937 HRESULT rc2 = mControl->DetachUSBDevice(aId, false /* aDone */); 2936 2938 if (FAILED(rc2)) 2937 2939 return rc2; 2938 alock. enter();2940 alock.acquire(); 2939 2941 2940 2942 /* Request the PDM to detach the USB device. */ … … 2943 2945 if (SUCCEEDED(rc)) 2944 2946 { 2945 /* leave the lock since we don't need it any more (note though that2947 /* release the lock since we don't need it any more (note though that 2946 2948 * the USB Proxy service must not call us back here) */ 2947 alock. leave();2949 alock.release(); 2948 2950 2949 2951 /* Request the device release. Even if it fails, the device will … … 3269 3271 /* 3270 3272 * If we fail here it means a PowerDown() call happened on another 3271 * thread while we were doing Pause() (which leaves the Console lock).3273 * thread while we were doing Pause() (which releases the Console lock). 3272 3274 * We assign PowerDown() a higher precedence than TakeSnapshot(), 3273 3275 * therefore just return the error to the caller. … … 3595 3597 fForce); 3596 3598 3597 /* leave the lock before waiting for a result (EMT will call us back!) */3598 alock. leave();3599 /* release the lock before waiting for a result (EMT will call us back!) */ 3600 alock.release(); 3599 3601 3600 3602 if (vrc == VERR_TIMEOUT || RT_SUCCESS(vrc)) … … 3848 3850 aMediumAttachment); 3849 3851 3850 /* leave the lock before waiting for a result (EMT will call us back!) */3851 alock. leave();3852 /* release the lock before waiting for a result (EMT will call us back!) */ 3853 alock.release(); 3852 3854 3853 3855 if (vrc == VERR_TIMEOUT || RT_SUCCESS(vrc)) … … 4089 4091 aMediumAttachment); 4090 4092 4091 /* leave the lock before waiting for a result (EMT will call us back!) */4092 alock. leave();4093 /* release the lock before waiting for a result (EMT will call us back!) */ 4094 alock.release(); 4093 4095 4094 4096 if (vrc == VERR_TIMEOUT || RT_SUCCESS(vrc)) … … 4498 4500 this, ptrVM.raw(), pszDevice, uInstance, uLun, aNetworkAdapter); 4499 4501 4500 /* leave the lock before waiting for a result (EMT will call us back!) */4501 alock. leave();4502 /* release the lock before waiting for a result (EMT will call us back!) */ 4503 alock.release(); 4502 4504 4503 4505 if (vrc == VERR_TIMEOUT || RT_SUCCESS(vrc)) … … 4833 4835 { 4834 4836 /* VRDP server may call this Console object back from other threads (VRDP INPUT or OUTPUT). */ 4835 alock. leave();4837 alock.release(); 4836 4838 4837 4839 if (vrdpEnabled) … … 4852 4854 } 4853 4855 4854 alock. enter();4856 alock.acquire(); 4855 4857 } 4856 4858 } … … 6688 6690 /* ---------------------------------------------------------------------- 6689 6691 * DONE with necessary state changes, perform the power down actions (it's 6690 * safe to leave the object lock now if needed)6692 * safe to release the object lock now if needed) 6691 6693 * ---------------------------------------------------------------------- */ 6692 6694 … … 6699 6701 /* Leave the lock since EMT will call us back as addVMCaller() 6700 6702 * in updateDisplayData(). */ 6701 alock. leave();6703 alock.release(); 6702 6704 6703 6705 mConsoleVRDPServer->Stop(); 6704 6706 6705 alock. enter();6707 alock.acquire(); 6706 6708 } 6707 6709 … … 6729 6731 mVMCallers)); 6730 6732 6731 alock. leave();6733 alock.release(); 6732 6734 6733 6735 RTSemEventWait(mVMZeroCallersSem, RT_INDEFINITE_WAIT); 6734 6736 6735 alock. enter();6737 alock.acquire(); 6736 6738 } 6737 6739 … … 6753 6755 { 6754 6756 LogFlowThisFunc(("Powering off the VM...\n")); 6755 alock. leave();6757 alock.release(); 6756 6758 vrc = VMR3PowerOff(VMR3GetVM(pUVM)); 6757 6759 #ifdef VBOX_WITH_EXTPACK 6758 6760 mptrExtPackManager->callAllVmPowerOffHooks(this, VMR3GetVM(pUVM)); 6759 6761 #endif 6760 alock. enter();6762 alock.acquire(); 6761 6763 } 6762 6764 … … 6772 6774 6773 6775 /* Leave the lock since EMT will call us back as addVMCaller() */ 6774 alock. leave();6776 alock.release(); 6775 6777 6776 6778 m_pVMMDev->hgcmShutdown(); 6777 6779 6778 alock. enter();6780 alock.acquire(); 6779 6781 } 6780 6782 … … 6805 6807 6806 6808 /* Now we've got to destroy the VM as well. (mpVM is not valid beyond 6807 * this point). We leave the lock before calling VMR3Destroy() because6809 * this point). We release the lock before calling VMR3Destroy() because 6808 6810 * it will result into calling destructors of drivers associated with 6809 6811 * Console children which may in turn try to lock Console (e.g. by … … 6818 6820 LogFlowThisFunc(("Destroying the VM...\n")); 6819 6821 6820 alock. leave();6822 alock.release(); 6821 6823 6822 6824 vrc = VMR3Destroy(VMR3GetVM(pUVM)); 6823 6825 6824 6826 /* take the lock again */ 6825 alock. enter();6827 alock.acquire(); 6826 6828 6827 6829 /* advance percent count */ … … 6930 6932 * UpdateState we will require Machine and SessionMachine locks 6931 6933 * (remember that here we're holding the Console lock here, and also 6932 * all locks that have been enteredby the thread before calling6934 * all locks that have been acquire by the thread before calling 6933 6935 * this method). 6934 6936 */ … … 7648 7650 AssertReturn(isWriteLockOnCurrentThread(), E_FAIL); 7649 7651 7650 /* still want a lock object because we need to leave it */7652 /* still want a lock object because we need to release it */ 7651 7653 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 7652 7654 … … 7680 7682 Address.c_str(), uuid.raw())); 7681 7683 7682 /* leave the lock before a VMR3* call (EMT will call us back)! */7683 alock. leave();7684 /* release the lock before a VMR3* call (EMT will call us back)! */ 7685 alock.release(); 7684 7686 7685 7687 /** @todo just do everything here and only wrap the PDMR3Usb call. That'll offload some notification stuff from the EMT thread. */ … … 7689 7691 7690 7692 /* restore the lock */ 7691 alock. enter();7693 alock.acquire(); 7692 7694 7693 7695 /* hrc is S_OK here */ … … 7790 7792 AssertReturn(isWriteLockOnCurrentThread(), E_FAIL); 7791 7793 7792 /* still want a lock object because we need to leave it */7794 /* still want a lock object because we need to release it */ 7793 7795 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 7794 7796 … … 7804 7806 (*aIt)->id().raw())); 7805 7807 7806 /* leave the lock before a VMR3* call (EMT will call us back)! */7807 alock. leave();7808 /* release the lock before a VMR3* call (EMT will call us back)! */ 7809 alock.release(); 7808 7810 7809 7811 /** @todo just do everything here and only wrap the PDMR3Usb call. That'll offload some notification stuff from the EMT thread. */ … … 8266 8268 if (RT_SUCCESS(vrc)) 8267 8269 { 8268 /* leave the lock before calling Host in VBoxSVC since Host may call8270 /* release the lock before calling Host in VBoxSVC since Host may call 8269 8271 * us back from under its lock (e.g. onUSBDeviceAttach()) which would 8270 8272 * produce an inter-process dead-lock otherwise. */ 8271 8273 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 8272 alock. leave();8274 alock.release(); 8273 8275 8274 8276 HRESULT hrc = mControl->AutoCaptureUSBDevices(); … … 8300 8302 mUSBDevices.clear(); 8301 8303 8302 /* leave the lock before calling Host in VBoxSVC since Host may call8304 /* release the lock before calling Host in VBoxSVC since Host may call 8303 8305 * us back from under its lock (e.g. onUSBDeviceAttach()) which would 8304 8306 * produce an inter-process dead-lock otherwise. */ 8305 8307 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 8306 alock. leave();8308 alock.release(); 8307 8309 8308 8310 mControl->DetachAllUSBDevices(aDone); … … 8575 8577 8576 8578 /* Does VRDP server call Console from the other thread? 8577 * Not sure (and can change), so leave the lock just in case.8579 * Not sure (and can change), so release the lock just in case. 8578 8580 */ 8579 alock. leave();8581 alock.release(); 8580 8582 vrc = server->Launch(); 8581 alock. enter();8583 alock.acquire(); 8582 8584 8583 8585 if (vrc == VERR_NET_ADDRESS_IN_USE) … … 8627 8629 PVM pVM; 8628 8630 /* 8629 * leave the lock since EMT will call Console. It's safe because8631 * release the lock since EMT will call Console. It's safe because 8630 8632 * mMachineState is either Starting or Restoring state here. 8631 8633 */ 8632 alock. leave();8634 alock.release(); 8633 8635 8634 8636 vrc = VMR3Create(cCpus, … … 8640 8642 &pVM); 8641 8643 8642 alock. enter();8644 alock.acquire(); 8643 8645 8644 8646 /* Enable client connections to the server. */ … … 8677 8679 { 8678 8680 /* Does the code below call Console from the other thread? 8679 * Not sure, so leave the lock just in case. */8680 alock. leave();8681 * Not sure, so release the lock just in case. */ 8682 alock.release(); 8681 8683 8682 8684 for (SharedFolderDataMap::const_iterator it = task->mSharedFolders.begin(); … … 8698 8700 rc = S_OK; // do not fail with broken shared folders 8699 8701 8700 /* enterthe lock again */8701 alock. enter();8702 /* acquire the lock again */ 8703 alock.acquire(); 8702 8704 } 8703 8705 … … 8708 8710 if (FAILED(rc)) break; 8709 8711 8710 /* leave the lock before a lengthy operation */8711 alock. leave();8712 /* release the lock before a lengthy operation */ 8713 alock.release(); 8712 8714 8713 8715 /* Load saved state? */ … … 8822 8824 } 8823 8825 8824 /* enterthe lock again */8825 alock. enter();8826 /* acquire the lock again */ 8827 alock.acquire(); 8826 8828 } 8827 8829 while (0); … … 8835 8837 /* powerDown() will call VMR3Destroy() and do all necessary 8836 8838 * cleanup (VRDP, USB devices) */ 8839 alock.release(); 8837 8840 HRESULT rc2 = pConsole->powerDown(); 8841 alock.acquire(); 8838 8842 AssertComRC(rc2); 8839 8843 } … … 8845 8849 * be sticky but our error callback isn't. 8846 8850 */ 8847 alock. leave();8851 alock.release(); 8848 8852 VMR3AtErrorDeregister(pVM, Console::genericVMSetErrorCallback, &task->mErrorMsg); 8849 8853 /** @todo register another VMSetError callback? */ 8850 alock. enter();8854 alock.acquire(); 8851 8855 } 8852 8856 } … … 8914 8918 */ 8915 8919 8916 /* leave the lock, don't need it any more */8917 alock. leave();8920 /* release the lock, don't need it any more */ 8921 alock.release(); 8918 8922 8919 8923 if (SUCCEEDED(rc)) … … 9114 9118 pTask->mProgress->setCancelCallback(takesnapshotProgressCancelCallback, ptrVM.rawUVM()); 9115 9119 9116 alock. leave();9120 alock.release(); 9117 9121 LogFlowFunc(("VMR3Save...\n")); 9118 9122 int vrc = VMR3Save(ptrVM, … … 9122 9126 static_cast<IProgress *>(pTask->mProgress), 9123 9127 &fSuspenededBySave); 9124 alock. enter();9128 alock.acquire(); 9125 9129 if (RT_FAILURE(vrc)) 9126 9130 throw setErrorStatic(E_FAIL, … … 9190 9194 9191 9195 /* 9192 * don't leave the lock since reconfigureMediumAttachment9196 * don't release the lock since reconfigureMediumAttachment 9193 9197 * isn't going to need the Console lock. 9194 9198 */ … … 9265 9269 LogFlowFunc(("VMR3Resume...\n")); 9266 9270 SafeVMPtr ptrVM(that); 9267 alock. leave();9271 alock.release(); 9268 9272 int vrc = VMR3Resume(ptrVM); 9269 alock. enter();9273 alock.acquire(); 9270 9274 if (RT_FAILURE(vrc)) 9271 9275 { … … 9323 9327 LogFlowFunc(("VMR3Resume (on failure)...\n")); 9324 9328 SafeVMPtr ptrVM(that); 9325 alock. leave();9329 alock.release(); 9326 9330 int vrc = VMR3Resume(ptrVM); AssertLogRelRC(vrc); 9327 alock. enter();9331 alock.acquire(); 9328 9332 if (RT_FAILURE(vrc)) 9329 9333 that->setMachineState(MachineState_Paused); … … 9411 9415 */ 9412 9416 task->releaseVMCaller(); 9417 thatLock.release(); 9413 9418 rc = that->powerDown(); 9419 thatLock.acquire(); 9414 9420 } 9415 9421 … … 9458 9464 /* release VM caller to avoid the powerDown() deadlock */ 9459 9465 task->releaseVMCaller(); 9466 9467 thatLock.release(); 9460 9468 9461 9469 that->powerDown(task->mServerProgress); -
trunk/src/VBox/Main/src-client/ConsoleImplTeleporter.cpp
r40066 r40257 5 5 6 6 /* 7 * Copyright (C) 2010 Oracle Corporation7 * Copyright (C) 2010-2012 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 886 886 if (pState->mfSuspendedByUs) 887 887 { 888 autoLock. leave();888 autoLock.release(); 889 889 int rc = VMR3Resume(VMR3GetVM(pState->mpUVM)); 890 890 AssertLogRelMsgRC(rc, ("VMR3Resume -> %Rrc\n", rc)); 891 autoLock. enter();891 autoLock.acquire(); 892 892 } 893 893 } … … 901 901 } 902 902 } 903 autoLock. leave();903 autoLock.release(); 904 904 905 905 /* -
trunk/src/VBox/Main/src-client/DisplayImpl.cpp
r39603 r40257 5 5 6 6 /* 7 * Copyright (C) 2006-201 0Oracle Corporation7 * Copyright (C) 2006-2012 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 2038 2038 if (pVM.isOk()) 2039 2039 { 2040 /* Must leave the lock here because the changeFramebuffer will2040 /* Must release the lock here because the changeFramebuffer will 2041 2041 * also obtain it. */ 2042 alock. leave();2042 alock.release(); 2043 2043 2044 2044 /* send request to the EMT thread */ … … 2046 2046 (PFNRT) changeFramebuffer, 3, this, aFramebuffer, aScreenId); 2047 2047 2048 alock. enter();2048 alock.acquire(); 2049 2049 2050 2050 ComAssertRCRet (vrc, E_FAIL); … … 2064 2064 VMMDev *pVMMDev = mParent->getVMMDev(); 2065 2065 2066 alock. leave();2066 alock.release(); 2067 2067 2068 2068 if (pVMMDev) … … 2070 2070 /*ComAssertRCRet (vrc, E_FAIL);*/ 2071 2071 2072 alock. enter();2072 alock.acquire(); 2073 2073 } 2074 2074 } … … 2155 2155 // return setError(E_FAIL, tr("Not enough VRAM for the selected video mode")); 2156 2156 2157 /* Have to leave the lock because the pfnRequestDisplayChange2157 /* Have to release the lock because the pfnRequestDisplayChange 2158 2158 * will call EMT. */ 2159 alock. leave();2159 alock.release(); 2160 2160 2161 2161 VMMDev *pVMMDev = mParent->getVMMDev(); … … 2176 2176 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 2177 2177 2178 /* Have to leave the lock because the pfnRequestSeamlessChange will call EMT. */2179 alock. leave();2178 /* Have to release the lock because the pfnRequestSeamlessChange will call EMT. */ 2179 alock.release(); 2180 2180 2181 2181 VMMDev *pVMMDev = mParent->getVMMDev(); … … 2377 2377 LogRelFlowFunc (("Sending SCREENSHOT request\n")); 2378 2378 2379 /* Leave lock because other thread (EMT) is called and it may initiate a resize2379 /* Release lock because other thread (EMT) is called and it may initiate a resize 2380 2380 * which also needs lock. 2381 2381 * 2382 2382 * This method does not need the lock anymore. 2383 2383 */ 2384 alock. leave();2384 alock.release(); 2385 2385 2386 2386 int vrc = displayTakeScreenshot(pVM, this, mpDrv, aScreenId, address, width, height); … … 2430 2430 LogRelFlowFunc (("Sending SCREENSHOT request\n")); 2431 2431 2432 /* Leave lock because other thread (EMT) is called and it may initiate a resize2432 /* Release lock because other thread (EMT) is called and it may initiate a resize 2433 2433 * which also needs lock. 2434 2434 * 2435 2435 * This method does not need the lock anymore. 2436 2436 */ 2437 alock. leave();2437 alock.release(); 2438 2438 2439 2439 size_t cbData = width * 4 * height; … … 2507 2507 LogRelFlowFunc (("Sending SCREENSHOT request\n")); 2508 2508 2509 /* Leave lock because other thread (EMT) is called and it may initiate a resize2509 /* Release lock because other thread (EMT) is called and it may initiate a resize 2510 2510 * which also needs lock. 2511 2511 * 2512 2512 * This method does not need the lock anymore. 2513 2513 */ 2514 alock. leave();2514 alock.release(); 2515 2515 2516 2516 size_t cbData = width * 4 * height; … … 2676 2676 if (FAILED(pVM.rc())) return pVM.rc(); 2677 2677 2678 /* Leave lock because the call scheduled on EMT may also try to take it. */2679 alock. leave();2678 /* Release lock because the call scheduled on EMT may also try to take it. */ 2679 alock.release(); 2680 2680 2681 2681 /* … … 2800 2800 LogRelFlowFunc (("Sending DPYUPDATE request\n")); 2801 2801 2802 /* Have to leave the lock when calling EMT. */2803 alock. leave();2802 /* Have to release the lock when calling EMT. */ 2803 alock.release(); 2804 2804 2805 2805 /* pdm.h says that this has to be called from the EMT thread */ 2806 2806 int rcVBox = VMR3ReqCallVoidWait(pVM, VMCPUID_ANY, (PFNRT)Display::InvalidateAndUpdateEMT, 2807 2807 1, this); 2808 alock. enter();2808 alock.acquire(); 2809 2809 2810 2810 if (RT_FAILURE(rcVBox)) … … 3003 3003 3004 3004 #if defined(VBOX_WITH_CROGL) 3005 /* Leave the lock, because SHCRGL_HOST_FN_SCREEN_CHANGED will read current framebuffer */3005 /* Release the lock, because SHCRGL_HOST_FN_SCREEN_CHANGED will read current framebuffer */ 3006 3006 { 3007 3007 BOOL is3denabled; … … 3010 3010 if (is3denabled) 3011 3011 { 3012 alock. leave();3012 alock.release(); 3013 3013 } 3014 3014 } -
trunk/src/VBox/Main/src-client/SessionImpl.cpp
r40177 r40257 5 5 6 6 /* 7 * Copyright (C) 2006-201 0Oracle Corporation7 * Copyright (C) 2006-2012 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 936 936 * SessionState_Closing here, so it's safe. 937 937 */ 938 alock. leave();938 alock.release(); 939 939 940 940 LogFlowThisFunc(("Calling mControl->OnSessionEnd()...\n")); … … 942 942 LogFlowThisFunc(("mControl->OnSessionEnd()=%08X\n", rc)); 943 943 944 alock. enter();944 alock.acquire(); 945 945 946 946 /*
Note:
See TracChangeset
for help on using the changeset viewer.