Skip to content

Commit 4c88c6f

Browse files
committed
CoreFoundation/RunLoop: define dispatch private type
If the private headers are not available, redefine the dispatch_runloop_handler_t type definition. This allows us to preserve the sugared type for the one type that we need from the private headers.
1 parent 0ebdd4f commit 4c88c6f

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

CoreFoundation/RunLoop.subproj/CFRunLoop.c

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,15 +46,24 @@ CF_INLINE uint64_t check_uint64_add(uint64_t x, uint64_t y, int32_t* err) {
4646
};
4747
#endif
4848

49-
#if __HAS_DISPATCH__ && __has_include(<dispatch/private.h>)
49+
#if __HAS_DISPATCH__
50+
#if __has_include(<dispatch/private.h>)
5051
#include <dispatch/private.h>
51-
#elif __HAS_DISPATCH__
52+
#else
5253
extern dispatch_queue_t _dispatch_runloop_root_queue_create_4CF(const char *_Nullable label, unsigned long flags);
5354
#if USE_DISPATCH_SOURCE_FOR_TIMERS
5455
extern mach_port_t _dispatch_runloop_root_queue_get_port_4CF(dispatch_queue_t queue);
5556
#endif
5657
extern void _dispatch_source_set_runloop_timer_4CF(dispatch_source_t source, dispatch_time_t start, uint64_t interval, uint64_t leeway);
5758
extern bool _dispatch_runloop_root_queue_perform_4CF(dispatch_queue_t queue);
59+
60+
#if TARGET_OS_MAC
61+
typedef mach_port_t dispatch_runloop_handle_t;
62+
#elif defined(__linux__) || defined(__FreeBSD__)
63+
typedef int dispatch_runloop_handle_t;
64+
#endif
65+
66+
#endif
5867
#endif
5968

6069
#if DEPLOYMENT_TARGET_MACOSX || DEPLOYMENT_TARGET_EMBEDDED || DEPLOYMENT_TARGET_EMBEDDED_MINI || DEPLOYMENT_TARGET_SIMULATOR

0 commit comments

Comments
 (0)