Changeset 71950 in vbox for trunk/src/VBox
- Timestamp:
- Apr 20, 2018 9:31:06 PM (7 years ago)
- Location:
- trunk/src/VBox/Runtime/r3
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/r3/socket.cpp
r71949 r71950 164 164 uint32_t fSubscribedEvts; 165 165 /** Saved events which are only posted once and events harvested for 166 * sockets entetered multiple times into to a poll set. */ 166 * sockets entered multiple times into to a poll set. Imagine a scenario where 167 * you have a RTPOLL_EVT_READ entry and RTPOLL_EVT_ERROR entry. The READ 168 * condition can be triggered between checking the READ entry and the ERROR 169 * entry, and we don't want to drop the READ, so we store it here and make sure 170 * the event is signalled. 171 * 172 * The RTPOLL_EVT_ERROR is inconsistenly sticky at the momemnt... */ 167 173 uint32_t fEventsSaved; 168 /** Set if fEventsSaved contains harvested events. */ 174 /** Set if fEventsSaved contains harvested events (used to avoid multiple 175 * calls to rtSocketPollCheck on the same socket during rtSocketPollDone). */ 169 176 bool fHarvestedEvents; 170 177 /** Set if we're using the polling fallback. */ … … 2843 2850 2844 2851 pThis->fEventsSaved = fRetEvents |= pThis->fEventsSaved; 2852 fRetEvents &= fEvents | RTPOLL_EVT_ERROR; 2845 2853 } 2846 2854 else … … 2957 2965 { 2958 2966 pThis->fPollEvts |= fEvents; 2959 if ( fFinalEntry 2960 && pThis->fSubscribedEvts != pThis->fPollEvts) 2961 { 2962 int rc = rtSocketPollUpdateEvents(pThis, pThis->fPollEvts); 2963 if (RT_FAILURE(rc)) 2967 if (fFinalEntry) 2968 { 2969 if (pThis->fSubscribedEvts != pThis->fPollEvts) 2964 2970 { 2965 pThis->fPollEvts = 0; 2966 fRetEvents = UINT32_MAX; 2971 /** @todo seems like there migth be a call to many here and that fPollEvts is 2972 * totally unnecessary... (bird) */ 2973 int rc = rtSocketPollUpdateEvents(pThis, pThis->fPollEvts); 2974 if (RT_FAILURE(rc)) 2975 { 2976 pThis->fPollEvts = 0; 2977 fRetEvents = UINT32_MAX; 2978 } 2967 2979 } 2980 2981 /* Make sure we don't block when there are events pending relevant to an earlier poll set entry. */ 2982 if (pThis->fEventsSaved && !pThis->fPollFallback && g_pfnWSASetEvent && fRetEvents == 0) 2983 g_pfnWSASetEvent(pThis->hEvent); 2968 2984 } 2969 2985 } … … 2977 2993 { 2978 2994 # ifdef RT_OS_WINDOWS 2995 pThis->fEventsSaved &= RTPOLL_EVT_ERROR; 2996 pThis->fHarvestedEvents = false; 2979 2997 rtSocketPollClearEventAndRestoreBlocking(pThis); 2980 2998 # endif 2981 2999 pThis->hPollSet = NIL_RTPOLLSET; 2982 3000 } 3001 # ifdef RT_OS_WINDOWS 3002 else 3003 pThis->fHarvestedEvents = true; 3004 # endif 2983 3005 ASMAtomicDecU32(&pThis->cUsers); 2984 3006 } … … 3069 3091 { 3070 3092 # ifdef RT_OS_WINDOWS 3071 pThis->fEventsSaved &= RTPOLL_EVT_ERROR;3093 pThis->fEventsSaved &= RTPOLL_EVT_ERROR; 3072 3094 pThis->fHarvestedEvents = false; 3073 3095 rtSocketPollClearEventAndRestoreBlocking(pThis); -
trunk/src/VBox/Runtime/r3/win/init-win.cpp
r71150 r71950 103 103 /** WSACloseEvent */ 104 104 DECLHIDDEN(PFNWSACLOSEEVENT) g_pfnWSACloseEvent = NULL; 105 /** WSASetEvent */ 106 DECLHIDDEN(PFNWSASETEVENT) g_pfnWSASetEvent = NULL; 105 107 /** WSAEventSelect */ 106 108 DECLHIDDEN(PFNWSAEVENTSELECT) g_pfnWSAEventSelect = NULL; … … 363 365 g_pfnWSACreateEvent = (decltype(g_pfnWSACreateEvent)) GetProcAddress(g_hModWinSock, "WSACreateEvent"); 364 366 g_pfnWSACloseEvent = (decltype(g_pfnWSACloseEvent)) GetProcAddress(g_hModWinSock, "WSACloseEvent"); 367 g_pfnWSASetEvent = (decltype(g_pfnWSASetEvent)) GetProcAddress(g_hModWinSock, "WSASetEvent"); 365 368 g_pfnWSAEventSelect = (decltype(g_pfnWSAEventSelect)) GetProcAddress(g_hModWinSock, "WSAEventSelect"); 366 369 g_pfnWSAEnumNetworkEvents = (decltype(g_pfnWSAEnumNetworkEvents))GetProcAddress(g_hModWinSock,"WSAEnumNetworkEvents"); … … 392 395 Assert(g_pfnWSACreateEvent || g_fOldWinSock); 393 396 Assert(g_pfnWSACloseEvent || g_fOldWinSock); 397 Assert(g_pfnWSASetEvent || g_fOldWinSock); 394 398 Assert(g_pfnWSAEventSelect || g_fOldWinSock); 395 399 Assert(g_pfnWSAEnumNetworkEvents || g_fOldWinSock); -
trunk/src/VBox/Runtime/r3/win/internal-r3-win.h
r71150 r71950 125 125 /** WSACreateEvent */ 126 126 typedef HANDLE (WINAPI *PFNWSACREATEEVENT)(void); 127 /** WSASetEvent */ 128 typedef BOOL (WINAPI *PFNWSASETEVENT)(HANDLE); 127 129 /** WSACloseEvent */ 128 130 typedef BOOL (WINAPI *PFNWSACLOSEEVENT)(HANDLE); … … 179 181 extern DECLHIDDEN(PFNWSACREATEEVENT) g_pfnWSACreateEvent; 180 182 extern DECLHIDDEN(PFNWSACLOSEEVENT) g_pfnWSACloseEvent; 183 extern DECLHIDDEN(PFNWSASETEVENT) g_pfnWSASetEvent; 181 184 extern DECLHIDDEN(PFNWSAEVENTSELECT) g_pfnWSAEventSelect; 182 185 extern DECLHIDDEN(PFNWSAENUMNETWORKEVENTS) g_pfnWSAEnumNetworkEvents;
Note:
See TracChangeset
for help on using the changeset viewer.