Skip to content

Commit 1b5e241

Browse files
committed
Fix Looper.Executor macOS build
1 parent 3e072fb commit 1b5e241

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

Sources/AndroidLooper/SerialExecutor.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,23 +73,25 @@ public extension Looper {
7373
internal extension Looper.Executor {
7474

7575
func configureLooper() throws(AndroidLooperError) {
76+
#if os(Android)
7677
do {
7778
// add to looper
7879
try looper.handle.add(fileDescriptor: .init(rawValue: eventFd.rawValue), callback: drainAExecutor, data: Unmanaged.passUnretained(self).toOpaque()).get()
7980
}
8081
catch {
81-
#if os(Android)
8282
try? eventFd.close()
83-
#endif
8483
throw error
8584
}
85+
#endif
8686
}
8787

8888
/// Read number of remaining events from eventFd
8989
var eventsRemaining: UInt64 {
9090
get throws {
9191
#if os(Android)
9292
try eventFd.read().rawValue
93+
#else
94+
0
9395
#endif
9496
}
9597
}

0 commit comments

Comments
 (0)