Skip to content

Commit 325de71

Browse files
[wasm] Include _CFIsMainThread for WASI platform (#5292)
Recent wasi-libc versions include pthreads support for both wasm32-wasip1 and wasm32-wasip1-threads targets.
1 parent 3f4ea17 commit 325de71

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

Sources/CoreFoundation/CFPlatform.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -304,9 +304,9 @@ const char *_CFProcessPath(void) {
304304
#endif
305305
}
306306

307-
#if TARGET_OS_MAC || TARGET_OS_WIN32 || TARGET_OS_BSD
307+
#if TARGET_OS_MAC || TARGET_OS_WIN32 || TARGET_OS_BSD || TARGET_OS_WASI
308308
CF_CROSS_PLATFORM_EXPORT Boolean _CFIsMainThread(void) {
309-
#if defined(__OpenBSD__) || defined(__FreeBSD__)
309+
#if defined(__OpenBSD__) || defined(__FreeBSD__) || TARGET_OS_WASI
310310
return pthread_equal(pthread_self(), _CFMainPThread) != 0;
311311
#else
312312
return pthread_main_np() == 1;

Sources/CoreFoundation/CFRuntime.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1195,8 +1195,6 @@ void __CFInitialize(void) {
11951195
#elif _POSIX_THREADS
11961196
// move this next line up into the #if above after Foundation gets off this symbol. Also: <rdar://problem/39622745> Stop using _CFMainPThread
11971197
_CFMainPThread = pthread_self();
1198-
#elif TARGET_OS_WASI
1199-
_CFMainPThread = kNilPthreadT;
12001198
#else
12011199
#error Dont know how to get the main thread on this platform
12021200
#endif

0 commit comments

Comments
 (0)