Changeset 30477 in vbox
- Timestamp:
- Jun 28, 2010 4:56:57 PM (15 years ago)
- svn:sync-xref-src-repo-rev:
- 63160
- Location:
- trunk/src/VBox/Main
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/EventImpl.cpp
r30476 r30477 239 239 HRESULT process(IEvent* aEvent, BOOL aWaitable, PendingEventsMap::iterator& pit, AutoLockBase& alock); 240 240 HRESULT enqueue(IEvent* aEvent); 241 HRESULT dequeue(IEvent* *aEvent, LONG aTimeout );241 HRESULT dequeue(IEvent* *aEvent, LONG aTimeout, AutoLockBase& aAlock); 242 242 HRESULT eventProcessed(IEvent * aEvent, PendingEventsMap::iterator& pit); 243 243 void addRef() … … 397 397 } 398 398 399 HRESULT ListenerRecord::process(IEvent* aEvent, BOOL aWaitable, PendingEventsMap::iterator& pit, AutoLockBase& alock) 399 HRESULT ListenerRecord::process(IEvent* aEvent, 400 BOOL aWaitable, 401 PendingEventsMap::iterator& pit, 402 AutoLockBase& aAlock) 400 403 { 401 404 if (mActive) … … 407 410 if (mListener) 408 411 { 409 a lock.release();412 aAlock.release(); 410 413 rc = mListener->HandleEvent(aEvent); 411 a lock.acquire();414 aAlock.acquire(); 412 415 } 413 416 if (aWaitable) … … 434 437 } 435 438 436 HRESULT ListenerRecord::dequeue (IEvent* *aEvent, LONG aTimeout) 439 HRESULT ListenerRecord::dequeue (IEvent* *aEvent, 440 LONG aTimeout, 441 AutoLockBase& aAlock) 437 442 { 438 443 AssertMsg(!mActive, ("must be passive\n")); … … 441 446 if (mQueue.empty()) 442 447 { 443 ::RTCritSectLeave(&mcsQLock); 448 // retain listener record 449 ListenerRecordHolder holder(this); 450 ::RTCritSectLeave(&mcsQLock); 444 451 // Speed up common case 445 452 if (aTimeout == 0) … … 448 455 return S_OK; 449 456 } 457 // release lock while waiting, listener will not go away due to above holder 458 aAlock.release(); 450 459 ::RTSemEventWait(mQEvent, aTimeout); 460 // reacquire lock 461 aAlock.acquire(); 451 462 ::RTCritSectEnter(&mcsQLock); 452 463 } … … 510 521 { 511 522 m->mListeners.clear(); 512 // m->mEvMap shall be cleared at this point too by destructors 523 // m->mEvMap shall be cleared at this point too by destructors, assert? 513 524 } 514 525 … … 644 655 * here, to make this wait preemptible, thus both take read lock (write 645 656 * lock in FireEvent() would do too, and probably is a bit stricter), 646 * but will interfere with.657 * but will be unable to . 647 658 */ 648 659 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); … … 652 663 653 664 if (it != m->mListeners.end()) 654 rc = it->second.obj()->dequeue(aEvent, aTimeout );665 rc = it->second.obj()->dequeue(aEvent, aTimeout, alock); 655 666 else 656 667 rc = setError(VBOX_E_OBJECT_NOT_FOUND, -
trunk/src/VBox/Main/idl/autogen.xsl
r30476 r30477 401 401 <xsl:template name="genCommonEventCode"> 402 402 <xsl:text><![CDATA[ 403 void VBoxEventDesc::getEvent(IEvent ** aEvent)404 {405 mEvent.queryInterfaceTo(aEvent);406 }407 403 HRESULT VBoxEventDesc::init(IEventSource* source, VBoxEventType_T aType, ...) 408 404 { -
trunk/src/VBox/Main/include/EventImpl.h
r30381 r30477 132 132 {} 133 133 134 /** 135 * This function to be used with some care, as arguments order must match attribute declaration order 136 * event class and its superclasses up to IEvent. If unsure, consult implementation in 137 * generated VBoxEvents.cpp. 138 */ 134 139 HRESULT init(IEventSource* aSource, VBoxEventType_T aType, ...); 135 void getEvent(IEvent ** aEvent); 140 141 void getEvent(IEvent ** aEvent) 142 { 143 mEvent.queryInterfaceTo(aEvent); 144 } 136 145 137 146 private:
Note:
See TracChangeset
for help on using the changeset viewer.