Skip to content

Commit 7d21208

Browse files
authored
[FreeBSD] Enable CFRunLoop support (#5188)
* Enable CFRunLoop for FreeBSD * match definition of dispatch_runloop_handle_t in libdispatch
1 parent cac38ff commit 7d21208

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

Sources/CoreFoundation/CFRunLoop.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,12 +72,14 @@ extern bool _dispatch_runloop_root_queue_perform_4CF(dispatch_queue_t queue);
7272

7373
#if TARGET_OS_MAC
7474
typedef mach_port_t dispatch_runloop_handle_t;
75-
#elif defined(__linux__) || defined(__FreeBSD__)
75+
#elif TARGET_OS_LINUX
7676
typedef int dispatch_runloop_handle_t;
77+
#elif TARGET_OS_BSD
78+
typedef uint64_t dispatch_runloop_handle_t;
7779
#elif TARGET_OS_WIN32
7880
typedef HANDLE dispatch_runloop_handle_t;
7981
#else
80-
typedef uint64_t dispatch_runloop_handle_t;
82+
#error "runloop support not implemented on this platform"
8183
#endif
8284

8385
#if TARGET_OS_MAC

Sources/Foundation/RunLoop.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ open class RunLoop: NSObject {
120120
// Make sure we honor the override -- var currentCFRunLoop will do so on platforms where overrides are available.
121121

122122
// TODO: This has been removed as public API in port to the package, because CoreFoundation cannot be available as both toolchain "CoreFoundation" and package "_CoreFoundation"
123-
#if os(Linux) || os(macOS) || os(iOS) || os(tvOS) || os(watchOS) || os(OpenBSD)
123+
#if os(Linux) || os(macOS) || os(iOS) || os(tvOS) || os(watchOS) || os(OpenBSD) || os(FreeBSD)
124124
internal var currentCFRunLoop: CFRunLoop { getCFRunLoop() }
125125

126126
internal func getCFRunLoop() -> CFRunLoop {

0 commit comments

Comments
 (0)