Changeset 52413 in vbox for trunk/src/VBox
- Timestamp:
- Aug 19, 2014 12:48:42 PM (11 years ago)
- svn:sync-xref-src-repo-rev:
- 95585
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/src-all/EventImpl.cpp
r50545 r52413 579 579 580 580 RTSEMEVENT mQEvent; 581 int32_t volatile mWaitCnt; 581 582 RTCRITSECT mcsQLock; 582 583 PassiveQueue mQueue; … … 725 726 BOOL aActive, 726 727 EventSource *aOwner) : 727 mActive(aActive), mOwner(aOwner), m RefCnt(0)728 mActive(aActive), mOwner(aOwner), mWaitCnt(0), mRefCnt(0) 728 729 { 729 730 mListener = aListener; … … 882 883 // release lock while waiting, listener will not go away due to above holder 883 884 aAlock.release(); 885 886 // In order to safely shutdown, count all waiting threads here. 887 ASMAtomicIncS32(&mWaitCnt); 884 888 ::RTSemEventWait(mQEvent, aTimeout); 889 ASMAtomicDecS32(&mWaitCnt); 890 885 891 // reacquire lock 886 892 aAlock.acquire(); … … 918 924 RTSEMEVENT tmp = mQEvent; 919 925 mQEvent = NIL_RTSEMEVENT; 926 927 /* On Darwin it is known that RTSemEventDestroy() returns 0 while 928 * corresponding thread remains to be blocked after that. In order to prevent 929 * undesireble freeze on shutdown, this workaround is used. */ 930 Log(("Wait for %d waiters to release.\n", ASMAtomicReadS32(&mWaitCnt))); 931 while (ASMAtomicReadS32(&mWaitCnt) > 0) 932 { 933 ::RTSemEventSignal(tmp); 934 935 /* Are we already done? */ 936 if (ASMAtomicReadS32(&mWaitCnt) == 0) 937 break; 938 939 RTThreadSleep(10); 940 } 941 Log(("All waiters just released the lock.\n")); 942 920 943 ::RTSemEventDestroy(tmp); 921 944 }
Note:
See TracChangeset
for help on using the changeset viewer.