Skip to content

Commit 716fa2f

Browse files
committed
Enable CF timer tolerance APIs on non-Darwin platforms
1 parent bbef726 commit 716fa2f

File tree

2 files changed

+45
-0
lines changed

2 files changed

+45
-0
lines changed

recipes-devtools/swift/swift-foundation.bb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ SRC_URI = "git://github.com/swiftlang/swift-corelibs-foundation.git;protocol=htt
1313
SRC_URI += "git://github.com/swiftlang/swift-foundation.git;protocol=https;name=foundation;tag=swift-${SWIFT_VERSION}-RELEASE;nobranch=1;destsuffix=swift-foundation;"
1414
SRC_URI += "git://github.com/swiftlang/swift-foundation-icu.git;protocol=https;name=icu;tag=swift-${SWIFT_VERSION}-RELEASE;nobranch=1;destsuffix=swift-foundation-icu;"
1515
SRC_URI += "git://github.com/swiftlang/swift-syntax.git;protocol=https;name=syntax;tag=swift-${SWIFT_VERSION}-RELEASE;nobranch=1;destsuffix=swift-syntax;"
16+
SRC_URI += "file://0001-CFRunLoopTimerGetTolerance-CFRunLoopTimerSetToleranc.patch;striplevel=1;"
1617

1718
S = "${WORKDIR}/git"
1819

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
From a38fd03fd9411ac5ffa94a523f0228f8ef75f058 Mon Sep 17 00:00:00 2001
2+
From: Luke Howard <lukeh@padl.com>
3+
Date: Tue, 4 Mar 2025 12:58:32 +1100
4+
Subject: [PATCH] CFRunLoopTimerGetTolerance/CFRunLoopTimerSetTolerance for
5+
non-Mac
6+
7+
---
8+
Sources/CoreFoundation/CFRunLoop.c | 6 ------
9+
1 file changed, 6 deletions(-)
10+
11+
diff --git a/Sources/CoreFoundation/CFRunLoop.c b/Sources/CoreFoundation/CFRunLoop.c
12+
index 91299fc5..3d2ed85d 100644
13+
--- a/Sources/CoreFoundation/CFRunLoop.c
14+
+++ b/Sources/CoreFoundation/CFRunLoop.c
15+
@@ -4735,18 +4735,13 @@ void CFRunLoopTimerGetContext(CFRunLoopTimerRef rlt, CFRunLoopTimerContext *cont
16+
}
17+
18+
CFTimeInterval CFRunLoopTimerGetTolerance(CFRunLoopTimerRef rlt) {
19+
-#if TARGET_OS_MAC
20+
CHECK_FOR_FORK();
21+
CF_OBJC_FUNCDISPATCHV(CFRunLoopTimerGetTypeID(), CFTimeInterval, (NSTimer *)rlt, tolerance);
22+
__CFGenericValidateType(rlt, CFRunLoopTimerGetTypeID());
23+
return rlt->_tolerance;
24+
-#else
25+
- return 0.0;
26+
-#endif
27+
}
28+
29+
void CFRunLoopTimerSetTolerance(CFRunLoopTimerRef rlt, CFTimeInterval tolerance) {
30+
-#if TARGET_OS_MAC
31+
CHECK_FOR_FORK();
32+
CF_OBJC_FUNCDISPATCHV(CFRunLoopTimerGetTypeID(), void, (NSTimer *)rlt, setTolerance:tolerance);
33+
__CFGenericValidateType(rlt, CFRunLoopTimerGetTypeID());
34+
@@ -4764,7 +4759,6 @@ void CFRunLoopTimerSetTolerance(CFRunLoopTimerRef rlt, CFTimeInterval tolerance)
35+
if (tolerance < 0) tolerance = 0.0;
36+
rlt->_tolerance = tolerance;
37+
}
38+
-#endif
39+
}
40+
41+
#endif /* __HAS_DISPATCH__ */
42+
--
43+
2.39.5 (Apple Git-154)
44+

0 commit comments

Comments
 (0)