Changeset 22128 in vbox
- Timestamp:
- Aug 10, 2009 11:56:08 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/common/VBoxGuest/VBoxGuest.cpp
r21632 r22128 19 19 * additional information or have any questions. 20 20 */ 21 22 21 23 22 … … 930 929 static int VBoxGuestCommonIOCtl_CancelAllWaitEvents(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession) 931 930 { 932 RTSPINLOCKTMP Tmp = RTSPINLOCKTMP_INITIALIZER; 933 PVBOXGUESTWAIT pWait; 934 int rc = 0; 931 RTSPINLOCKTMP Tmp = RTSPINLOCKTMP_INITIALIZER; 932 #if defined(RT_OS_SOLARIS) 933 RTTHREADPREEMPTSTATE State = RTTHREADPREEMPTSTATE_INITIALIZER; 934 #endif 935 PVBOXGUESTWAIT pWait; 936 int rc = 0; 935 937 936 938 Log(("VBoxGuestCommonIOCtl: CANCEL_ALL_WAITEVENTS\n")); … … 938 940 /* 939 941 * Walk the event list and wake up anyone with a matching session. 940 */ 942 * 943 * Note! On Solaris we have to do really ugly stuff here because 944 * RTSemEventMultiSignal cannot be called with interrupts disabled. 945 * The hack is racy, but what we can we do... (Eliminate this 946 * termination hack, perhaps?) 947 */ 948 #if defined(RT_OS_SOLARIS) 949 RTThreadPreemptDisable(&State); 950 RTSpinlockAcquireNoInts(pDevExt->EventSpinlock, &Tmp); 951 do 952 { 953 for (pWait = pDevExt->WaitList.pHead; pWait; pWait = pWait->pNext) 954 if ( pWait->pSession == pSession 955 && pWait->fResEvents != UINT32_MAX) 956 { 957 RTSEMEVENTMULTI hEvent; 958 pWait->fResEvents = UINT32_MAX; 959 RTSpinlockReleaseNoInts(pDevExt->EventSpinlock, &Tmp); 960 /* HACK ALRET! This races wakeup + reuse! */ 961 rc |= RTSemEventMultiSignal(hEvent); 962 RTSpinlockAcquireNoInts(pDevExt->EventSpinlock, &Tmp); 963 break; 964 } 965 } while (pWait); 966 RTSpinlockReleaseNoInts(pDevExt->EventSpinlock, &Tmp); 967 RTThreadPreemptDisable(&State); 968 #else 941 969 RTSpinlockAcquireNoInts(pDevExt->EventSpinlock, &Tmp); 942 970 for (pWait = pDevExt->WaitList.pHead; pWait; pWait = pWait->pNext) … … 947 975 } 948 976 RTSpinlockReleaseNoInts(pDevExt->EventSpinlock, &Tmp); 977 #endif 949 978 Assert(rc == 0); 950 979 … … 1629 1658 /* 1630 1659 * Enter the spinlock and check if it's our IRQ or not. 1631 */ 1660 * 1661 * Note! Solaris cannot do RTSemEventMultiSignal with interrupts disabled 1662 * so we're entering the spinlock without disabling them. This works 1663 * fine as long as we never called in a nested fashion. 1664 */ 1665 #if defined(RT_OS_SOLARIS) 1666 RTSpinlockAcquire(pDevExt->EventSpinlock, &Tmp); 1667 #else 1632 1668 RTSpinlockAcquireNoInts(pDevExt->EventSpinlock, &Tmp); 1669 #endif 1633 1670 fOurIrq = pDevExt->pVMMDevMemory->V.V1_04.fHaveEvents; 1634 1671 if (fOurIrq) … … 1703 1740 * Do this outside the spinlock to prevent some recursive spinlocking. 1704 1741 */ 1742 #if defined(RT_OS_SOLARIS) 1743 RTSpinlockRelease(pDevExt->EventSpinlock, &Tmp); 1744 #else 1705 1745 RTSpinlockReleaseNoInts(pDevExt->EventSpinlock, &Tmp); 1746 #endif 1706 1747 1707 1748 if (fMousePositionChanged)
Note:
See TracChangeset
for help on using the changeset viewer.