Changeset 96582 in vbox for trunk/src/VBox/Runtime/r3
- Timestamp:
- Sep 2, 2022 3:22:35 PM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/r3/posix/thread-posix.cpp
r96519 r96582 664 664 RTDECL(RTTHREAD) RTThreadSelf(void) 665 665 { 666 PRTTHREADINT pThread = (PRTTHREADINT)pthread_getspecific(g_SelfKey);667 666 /** @todo import alien threads? */ 668 return pThread; 667 #if defined(RT_OS_DARWIN) 668 /* On darwin, there seems to be input checking with pthread_getspecific. 669 So, we must prevent using g_SelfKey before rtThreadNativeInit has run, 670 otherwise we might crash or starting working with total garbage pointer 671 values here (see _os_tsd_get_direct in znu/libsyscall/os/tsd.h). 672 673 Now, since the init value is a "negative" one, we just have to check 674 that it's positive or zero before calling the API. */ 675 if (RT_LIKELY((intptr_t)g_SelfKey >= 0)) 676 return (PRTTHREADINT)pthread_getspecific(g_SelfKey); 677 return NIL_RTTHREAD; 678 #else 679 return (PRTTHREADINT)pthread_getspecific(g_SelfKey); 680 #endif 669 681 } 670 682
Note:
See TracChangeset
for help on using the changeset viewer.