Changeset 95765 in vbox for trunk/src/VBox/Runtime/r3/win/thread-win.cpp
- Timestamp:
- Jul 20, 2022 7:37:11 PM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/r3/win/thread-win.cpp
r93115 r95765 32 32 #include <iprt/nt/nt-and-windows.h> 33 33 34 #include <errno.h> 35 #include <process.h> 34 #ifndef IPRT_NO_CRT 35 # include <errno.h> 36 # include <process.h> 37 #endif 36 38 37 39 #include <iprt/thread.h> … … 84 86 * Internal Functions * 85 87 *********************************************************************************************************************************/ 86 static unsigned __stdcall rtThreadNativeMain(void *pvArgs) RT_NOTHROW_PROTO;87 88 static void rtThreadWinTellDebuggerThreadName(uint32_t idThread, const char *pszName); 88 89 DECLINLINE(void) rtThreadWinSetThreadName(PRTTHREADINT pThread, DWORD idThread); … … 348 349 * Wrapper which unpacks the param stuff and calls thread function. 349 350 */ 351 #ifndef IPRT_NO_CRT 350 352 static unsigned __stdcall rtThreadNativeMain(void *pvArgs) RT_NOTHROW_DEF 353 #else 354 static DWORD __stdcall rtThreadNativeMain(void *pvArgs) RT_NOTHROW_DEF 355 #endif 351 356 { 352 357 DWORD dwThreadId = GetCurrentThreadId(); … … 368 373 TlsSetValue(g_dwSelfTLS, NULL); 369 374 rtThreadNativeUninitComAndOle(); 375 #ifndef IPRT_NO_CRT 370 376 _endthreadex(rc); 371 return rc; 377 return rc; /* not reached */ 378 #else 379 for (;;) 380 ExitThread(rc); 381 #endif 372 382 } 373 383 … … 389 399 */ 390 400 pThread->hThread = (uintptr_t)INVALID_HANDLE_VALUE; 401 #ifndef IPRT_NO_CRT 391 402 unsigned uThreadId = 0; 392 uintptr_t hThread = _beginthreadex(NULL , cbStack, rtThreadNativeMain, pThread, 0, &uThreadId);403 uintptr_t hThread = _beginthreadex(NULL /*pSecAttrs*/, cbStack, rtThreadNativeMain, pThread, 0 /*fFlags*/, &uThreadId); 393 404 if (hThread != 0 && hThread != ~0U) 394 405 { … … 398 409 } 399 410 return RTErrConvertFromErrno(errno); 411 #else 412 DWORD idThread = 0; 413 HANDLE hThread = CreateThread(NULL /*pSecAttrs*/, cbStack, rtThreadNativeMain, pThread, 0 /*fFlags*/, &idThread); 414 if (hThread != NULL) 415 { 416 pThread->hThread = (uintptr_t)hThread; 417 *pNativeThread = idThread; 418 return VINF_SUCCESS; 419 } 420 return RTErrConvertFromWin32(GetLastError()); 421 #endif 400 422 } 401 423
Note:
See TracChangeset
for help on using the changeset viewer.