Skip to content

Commit 69dcd05

Browse files
committed
base: define _CFThreadCreate for windows
Define _CFThreadCreate in terms of _beginthreadex on Windows rather than pthread_create.
1 parent 468aabb commit 69dcd05

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

CoreFoundation/Base.subproj/CFPlatform.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
#include <shlobj.h>
2828
#include <WinIoCtl.h>
2929
#include <direct.h>
30+
#include <process.h>
3031
#define SECURITY_WIN32
3132
#include <Security.h>
3233

@@ -1368,9 +1369,15 @@ void _CFThreadSpecificSet(_CFThreadSpecificKey key, CFTypeRef _Nullable value) {
13681369
}
13691370

13701371
_CFThreadRef _CFThreadCreate(const _CFThreadAttributes attrs, void *_Nullable (* _Nonnull startfn)(void *_Nullable), void *_CF_RESTRICT _Nullable context) {
1372+
#if DEPLOYMENT_TARGET_WINDOWS
1373+
return (_CFThreadRef)_beginthreadex(NULL, 0,
1374+
(_beginthreadex_proc_type)startfn,
1375+
context, 0, NULL);
1376+
#else
13711377
_CFThreadRef thread;
13721378
pthread_create(&thread, &attrs, startfn, context);
13731379
return thread;
1380+
#endif
13741381
}
13751382

13761383
CF_CROSS_PLATFORM_EXPORT int _CFThreadSetName(_CFThreadRef thread, const char *_Nonnull name) {

0 commit comments

Comments
 (0)