Changeset 40465 in vbox for trunk/src/VBox/Main/src-client
- Timestamp:
- Mar 14, 2012 2:28:33 PM (13 years ago)
- svn:sync-xref-src-repo-rev:
- 76831
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/src-client/ConsoleImpl.cpp
r40302 r40465 2435 2435 return ptrVM.rc(); 2436 2436 2437 /** @todo release the console lock? */ 2437 // no need to release lock, as there are no cross-thread callbacks 2438 2438 2439 2439 /* get the acpi device interface and press the button. */ … … 2483 2483 return ptrVM.rc(); 2484 2484 2485 /** @todo release the console lock? */ 2485 // no need to release lock, as there are no cross-thread callbacks 2486 2486 2487 2487 /* get the acpi device interface and check if the button press was handled. */ … … 2538 2538 return ptrVM.rc(); 2539 2539 2540 /** @todo release the console lock? */ 2540 // no need to release lock, as there are no cross-thread callbacks 2541 2541 2542 2542 /* get the acpi device interface and query the information. */ … … 2579 2579 return ptrVM.rc(); 2580 2580 2581 /** @todo release the console lock? */ 2581 // no need to release lock, as there are no cross-thread callbacks 2582 2582 2583 2583 /* get the acpi device interface and press the sleep button. */ … … 2800 2800 } 2801 2801 2802 /** read the value of a LE d. */2802 /** read the value of a LED. */ 2803 2803 inline uint32_t readAndClearLed(PPDMLED pLed) 2804 2804 { … … 4323 4323 AssertComRC(rc); 4324 4324 const char *pszAdapterName = networkAdapterTypeToName(adapterType); 4325 4326 // prevent cross-thread deadlocks, don't need the lock any more 4327 alock.release(); 4328 4325 4329 PPDMIBASE pBase; 4326 4330 int vrc = PDMR3QueryDeviceLun(ptrVM, pszAdapterName, ulInstance, 0, &pBase); … … 4374 4378 } 4375 4379 4380 // definitely don't need the lock any more 4381 alock.release(); 4382 4376 4383 /* notify console callbacks on success */ 4377 4384 if (SUCCEEDED(rc)) 4378 {4379 alock.release(); /** @todo 101% safe? */4380 4385 fireNetworkAdapterChangedEvent(mEventSource, aNetworkAdapter); 4381 }4382 4386 4383 4387 LogFlowThisFunc(("Leaving rc=%#x\n", rc)); … … 4485 4489 * @param uLun The PDM LUN number of the drive. 4486 4490 * @param aNetworkAdapter The network adapter whose attachment needs to be changed 4487 *4488 * @note Locks this object for writing.4489 4491 */ 4490 4492 HRESULT Console::doNetworkAdapterChange(PVM pVM, … … 4499 4501 AutoCaller autoCaller(this); 4500 4502 AssertComRCReturnRC(autoCaller.rc()); 4501 4502 /* We will need to release the write lock before calling EMT */4503 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);4504 4503 4505 4504 /* Get the VM handle. */ … … 4517 4516 (PFNRT) Console::changeNetworkAttachment, 6, 4518 4517 this, ptrVM.raw(), pszDevice, uInstance, uLun, aNetworkAdapter); 4519 4520 /* release the lock before waiting for a result (EMT will call us back!) */4521 alock.release();4522 4518 4523 4519 if (vrc == VERR_TIMEOUT || RT_SUCCESS(vrc)) … … 4968 4964 if (aError != NULL) 4969 4965 { 4966 alock.release(); 4970 4967 /* notify callbacks about the error */ 4971 4968 onUSBDeviceStateChange(aDevice, true /* aAttached */, aError); … … 4979 4976 return E_FAIL; 4980 4977 } 4978 4979 alock.release(); 4981 4980 4982 4981 HRESULT rc = attachUSBDevice(aDevice, aMaskedIfs); … … 5055 5054 AssertFailedReturn(E_FAIL); 5056 5055 } 5056 5057 alock.release(); 5057 5058 5058 5059 if (aError != NULL) … … 5154 5155 AssertComRCReturnRC(autoCaller.rc()); 5155 5156 5156 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);5157 5158 5157 HRESULT rc = S_OK; 5159 5158 … … 5171 5170 /* notify console callbacks on success */ 5172 5171 if (SUCCEEDED(rc)) 5173 {5174 alock.release(); /** @todo 101% safe? */5175 5172 fireStorageDeviceChangedEvent(mEventSource, aMediumAttachment, aRemove); 5176 }5177 5173 5178 5174 LogFlowThisFunc(("Leaving rc=%#x\n", rc)); … … 6813 6809 { 6814 6810 fHasUSBController = true; 6811 alock.release(); 6815 6812 detachAllUSBDevices(false /* aDone */); 6813 alock.acquire(); 6816 6814 } 6817 6815 } … … 6866 6864 /* Complete the detaching of the USB devices. */ 6867 6865 if (fHasUSBController) 6866 { 6867 alock.release(); 6868 6868 detachAllUSBDevices(true /* aDone */); 6869 alock.acquire(); 6870 } 6869 6871 6870 6872 /* advance percent count */ … … 7661 7663 AssertReturn(isWriteLockOnCurrentThread(), E_FAIL); 7662 7664 7663 /* still want a lock object because we need to release it */7664 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);7665 7666 7665 HRESULT hrc; 7667 7666 … … 7693 7692 Address.c_str(), uuid.raw())); 7694 7693 7695 /* release the lock before a VMR3* call (EMT will call us back)! */7696 alock.release();7697 7698 7694 /** @todo just do everything here and only wrap the PDMR3Usb call. That'll offload some notification stuff from the EMT thread. */ 7699 7695 int vrc = VMR3ReqCallWait(ptrVM, VMCPUID_ANY, 7700 7696 (PFNRT)usbAttachCallback, 7, 7701 7697 this, ptrVM.raw(), aHostDevice, uuid.raw(), fRemote, Address.c_str(), aMaskedIfs); 7702 7703 /* restore the lock */7704 alock.acquire();7705 7698 7706 7699 /* hrc is S_OK here */ … … 7780 7773 LogFlowFunc(("Attached device {%RTuuid}\n", pUSBDevice->id().raw())); 7781 7774 7775 alock.release(); 7776 7782 7777 /* notify callbacks */ 7783 7778 that->onUSBDeviceStateChange(pUSBDevice, true /* aAttached */, NULL); … … 7803 7798 AssertReturn(isWriteLockOnCurrentThread(), E_FAIL); 7804 7799 7805 /* still want a lock object because we need to release it */7806 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);7807 7808 7800 /* Get the VM handle. */ 7809 7801 SafeVMPtr ptrVM(this); … … 7816 7808 LogFlowThisFunc(("Detaching USB proxy device {%RTuuid}...\n", 7817 7809 (*aIt)->id().raw())); 7818 7819 /* release the lock before a VMR3* call (EMT will call us back)! */7820 alock.release();7821 7810 7822 7811 /** @todo just do everything here and only wrap the PDMR3Usb call. That'll offload some notification stuff from the EMT thread. */ … … 7873 7862 that->mUSBDevices.erase(*aIt); 7874 7863 LogFlowFunc(("Detached device {%RTuuid}\n", pUSBDevice->id().raw())); 7864 7865 alock.release(); 7875 7866 7876 7867 /* notify callbacks */ … … 8263 8254 * 8264 8255 * @param pVM The VM handle. 8265 *8266 * @note The caller must lock this object for writing.8267 8256 */ 8268 8257 HRESULT Console::captureUSBDevices(PVM pVM) … … 8271 8260 8272 8261 /* sanity check */ 8273 ComAssertRet(isWriteLockOnCurrentThread(), E_FAIL); 8262 AssertReturn(!isWriteLockOnCurrentThread(), E_FAIL); 8263 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 8274 8264 8275 8265 /* If the machine has an USB controller, ask the USB proxy service to … … 8282 8272 * us back from under its lock (e.g. onUSBDeviceAttach()) which would 8283 8273 * produce an inter-process dead-lock otherwise. */ 8284 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);8285 8274 alock.release(); 8286 8275 … … 8301 8290 * Detach all USB device which are attached to the VM for the 8302 8291 * purpose of clean up and such like. 8303 *8304 * @note The caller must lock this object for writing.8305 8292 */ 8306 8293 void Console::detachAllUSBDevices(bool aDone) … … 8309 8296 8310 8297 /* sanity check */ 8311 AssertReturnVoid(isWriteLockOnCurrentThread()); 8298 AssertReturnVoid(!isWriteLockOnCurrentThread()); 8299 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 8312 8300 8313 8301 mUSBDevices.clear(); … … 8316 8304 * us back from under its lock (e.g. onUSBDeviceAttach()) which would 8317 8305 * produce an inter-process dead-lock otherwise. */ 8318 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);8319 8306 alock.release(); 8320 8307 … … 8415 8402 if (fMatched) 8416 8403 { 8404 alock.release(); 8417 8405 hrc = onUSBDeviceAttach(pUSBDevice, NULL, fMaskedIfs); 8406 alock.acquire(); 8418 8407 8419 8408 /// @todo (r=dmik) warning reporting subsystem … … 8480 8469 Bstr uuid; 8481 8470 pUSBDevice->COMGETTER(Id)(uuid.asOutParam()); 8471 alock.release(); 8482 8472 onUSBDeviceDetach(uuid.raw(), NULL); 8473 alock.acquire(); 8483 8474 } 8484 8475 … … 8715 8706 } 8716 8707 8708 /* release the lock before a lengthy operation */ 8709 alock.release(); 8710 8717 8711 /* 8718 8712 * Capture USB devices. … … 8720 8714 rc = pConsole->captureUSBDevices(pVM); 8721 8715 if (FAILED(rc)) break; 8722 8723 /* release the lock before a lengthy operation */8724 alock.release();8725 8716 8726 8717 /* Load saved state? */
Note:
See TracChangeset
for help on using the changeset viewer.