Skip to content
This repository was archived by the owner on Mar 6, 2025. It is now read-only.

Commit e388fca

Browse files
committed
Merge branch 'master' of https://github.com/luoxiu/Schedule
2 parents 764b00a + 0f2b71d commit e388fca

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

Sources/Schedule/RunLoopTask.swift

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,23 @@ private final class RunLoopTask: Task {
5858
guard let task = task as? RunLoopTask, let timer = task.timer else { return }
5959
timer.fireDate = Date()
6060
}
61+
62+
#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS)
6163

6264
timer = CFRunLoopTimerCreateWithHandler(kCFAllocatorDefault, Date.distantFuture.timeIntervalSinceReferenceDate, .greatestFiniteMagnitude, 0, 0, { [weak self] _ in
6365
guard let self = self else { return }
6466
action(self)
6567
})
6668

69+
#elseif os(Linux)
70+
71+
timer = Timer(fire: Date.distantFuture, interval: .greatestFiniteMagnitude, repeats: true) { [weak self] _ in
72+
guard let self = self else { return }
73+
action(self)
74+
}
75+
76+
#endif
77+
6778
RunLoop.current.add(timer, forMode: mode)
6879
}
6980

0 commit comments

Comments
 (0)