Skip to content

Commit df41899

Browse files
committed
Fix compilation issues with HAS_DISPATCH on Linux
1 parent ceb15d8 commit df41899

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

CoreFoundation/Base.subproj/CFInternal.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -805,7 +805,7 @@ CF_EXPORT void _NS_pthread_setname_np(const char *name);
805805
#define pthread_setname_np _NS_pthread_setname_np
806806
#endif
807807

808-
#if DEPLOYMENT_TARGET_WINDOWS
808+
#if DEPLOYMENT_TARGET_WINDOWS || DEPLOYMENT_TARGET_LINUX
809809
// replacement for DISPATCH_QUEUE_OVERCOMMIT until we get a bug fix in dispatch on Windows
810810
// <rdar://problem/7923891> dispatch on Windows: Need queue_private.h
811811
#define DISPATCH_QUEUE_OVERCOMMIT 2
@@ -866,7 +866,6 @@ CF_INLINE long qos_class_main() {
866866
CF_INLINE long qos_class_self() {
867867
return QOS_CLASS_DEFAULT;
868868
}
869-
870869
#endif
871870

872871
// Returns a generic dispatch queue for when you want to just throw some work

CoreFoundation/RunLoop.subproj/CFRunLoop.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2541,7 +2541,7 @@ static int32_t __CFRunLoopRun(CFRunLoopRef rl, CFRunLoopModeRef rlm, CFTimeInter
25412541
}
25422542

25432543
#if __HAS_DISPATCH__
2544-
mach_port_name_t dispatchPort = MACH_PORT_NULL;
2544+
__CFPort dispatchPort = CFPORT_NULL;
25452545
Boolean libdispatchQSafe = pthread_main_np() && ((HANDLE_DISPATCH_ON_BASE_INVOCATION_ONLY && NULL == previousMode) || (!HANDLE_DISPATCH_ON_BASE_INVOCATION_ONLY && 0 == _CFGetTSD(__CFTSDKeyIsInGCDMainQ)));
25462546
if (libdispatchQSafe && (CFRunLoopGetMain() == rl) && CFSetContainsValue(rl->_commonModes, rlm->_name)) dispatchPort = _dispatch_get_main_queue_port_4CF();
25472547
#endif
@@ -2798,7 +2798,7 @@ static int32_t __CFRunLoopRun(CFRunLoopRef rl, CFRunLoopModeRef rlm, CFTimeInter
27982798
__CFRunLoopModeUnlock(rlm);
27992799
__CFRunLoopUnlock(rl);
28002800
_CFSetTSD(__CFTSDKeyIsInGCDMainQ, (void *)6, NULL);
2801-
#if DEPLOYMENT_TARGET_WINDOWS
2801+
#if DEPLOYMENT_TARGET_WINDOWS || DEPLOYMENT_TARGET_LINUX
28022802
void *msg = 0;
28032803
#endif
28042804
__CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__(msg);

CoreFoundation/Stream.subproj/CFStream.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1690,7 +1690,11 @@ static void _perform(void* info)
16901690

16911691
static void* _legacyStreamRunLoop_workThread(void* arg)
16921692
{
1693+
#if DEPLOYMENT_TARGET_LINUX || DEPLOYMENT_TARGET_FREEBSD
1694+
pthread_setname_np(pthread_self(), "com.apple.CFStream.LegacyThread");
1695+
#else
16931696
pthread_setname_np("com.apple.CFStream.LegacyThread");
1697+
#endif
16941698
sLegacyRL = CFRunLoopGetCurrent();
16951699

16961700
#if defined(LOG_STREAM)

0 commit comments

Comments
 (0)