Changeset 66120 in vbox
- Timestamp:
- Mar 15, 2017 7:59:48 PM (8 years ago)
- svn:sync-xref-src-repo-rev:
- 114011
- Location:
- trunk/src/VBox/Runtime
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/common/misc/thread.cpp
r65620 r66120 1166 1166 if (pThread->fFlags & RTTHREADFLAGS_WAITABLE) 1167 1167 { 1168 if (fAutoResume) 1169 rc = RTSemEventMultiWait(pThread->EventTerminated, cMillies); 1168 #if defined(IN_RING3) && defined(RT_OS_WINDOWS) 1169 if (RT_LIKELY(rtThreadNativeIsAliveKludge(pThread))) 1170 #endif 1171 { 1172 if (fAutoResume) 1173 rc = RTSemEventMultiWait(pThread->EventTerminated, cMillies); 1174 else 1175 rc = RTSemEventMultiWaitNoResume(pThread->EventTerminated, cMillies); 1176 } 1177 #if defined(IN_RING3) && defined(RT_OS_WINDOWS) 1170 1178 else 1171 rc = RTSemEventMultiWaitNoResume(pThread->EventTerminated, cMillies); 1179 { 1180 rc = VINF_SUCCESS; 1181 if (pThread->rc == VERR_PROCESS_RUNNING) 1182 pThread->rc = VERR_THREAD_IS_DEAD; 1183 } 1184 #endif 1172 1185 if (RT_SUCCESS(rc)) 1173 1186 { -
trunk/src/VBox/Runtime/include/internal/thread.h
r62477 r66120 180 180 DECLHIDDEN(void) rtThreadNativeDestroy(PRTTHREADINT pThread); 181 181 182 #ifdef IN_RING3 183 /** 184 * Called to check whether the thread is still alive or not before we start 185 * waiting. 186 * 187 * This is a kludge to deal with windows threads being killed wholesale in 188 * certain process termination scenarios and we don't want to hang the last 189 * thread because it's waiting on the semaphore of a dead thread. 190 * 191 * @returns true if alive, false if not. 192 * @param pThread The thread structure. 193 */ 194 DECLHIDDEN(bool) rtThreadNativeIsAliveKludge(PRTTHREADINT pThread); 195 #endif 196 182 197 #ifdef IN_RING0 183 198 /** -
trunk/src/VBox/Runtime/r3/win/thread-win.cpp
r62592 r66120 30 30 *********************************************************************************************************************************/ 31 31 #define LOG_GROUP RTLOGGROUP_THREAD 32 #include <iprt/ win/windows.h>32 #include <iprt/nt/nt-and-windows.h> 33 33 34 34 #include <errno.h> … … 279 279 280 280 281 DECLHIDDEN(bool) rtThreadNativeIsAliveKludge(PRTTHREADINT pThread) 282 { 283 PPEB_COMMON pPeb = NtCurrentPeb(); 284 if (!pPeb || !pPeb->Ldr || !pPeb->Ldr->ShutdownInProgress) 285 return true; 286 DWORD rcWait = WaitForSingleObject((HANDLE)pThread->hThread, 0); 287 return rcWait != WAIT_OBJECT_0; 288 } 289 290 281 291 RTDECL(RTTHREAD) RTThreadSelf(void) 282 292 {
Note:
See TracChangeset
for help on using the changeset viewer.