Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion CoreFoundation/Base.subproj/CFPlatform.c
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,11 @@ const char *_CFProcessPath(void) {

#if TARGET_OS_MAC || TARGET_OS_WIN32 || TARGET_OS_BSD
CF_CROSS_PLATFORM_EXPORT Boolean _CFIsMainThread(void) {
#if defined(__OpenBSD__)
return pthread_equal(pthread_self(), _CFMainPThread) != 0;
#else
return pthread_main_np() == 1;
#endif
}
#endif

Expand Down Expand Up @@ -774,7 +778,7 @@ static void __CFTSDFinalize(void *arg) {
#if TARGET_OS_WASI
__CFMainThreadHasExited = true;
#else
if (pthread_main_np() == 1) {
if (_CFIsMainThread()) {
// Important: we need to be sure that the only time we set this flag to true is when we actually can guarentee we ARE the main thread.
__CFMainThreadHasExited = true;
}
Expand Down
Loading