Make events property of Inotify nonisolated
Some checks failed
Docs / docs (push) Has been cancelled
Docs / deploy (push) Has been cancelled

Properties of actors are implicitly isolated. To be able to read the
events stream from any concurrent context, we need to declare it
nonisolated. And as AsyncStream conforms to Sendable, it is safe to make
both events and the private eventStream nonisolated.
This commit is contained in:
T. R. Bernstein
2026-03-23 20:15:57 +01:00
parent 6927464d47
commit 10943f9ce3

View File

@@ -6,8 +6,8 @@ public actor Inotify {
private var excludedItemNames: Set<String> = [] private var excludedItemNames: Set<String> = []
private var watches = InotifyWatchManager() private var watches = InotifyWatchManager()
private var eventReader: any DispatchSourceRead private var eventReader: any DispatchSourceRead
private var eventStream: AsyncStream<RawInotifyEvent> private nonisolated let eventStream: AsyncStream<RawInotifyEvent>
public var events: AsyncCompactMapSequence<AsyncStream<RawInotifyEvent>, InotifyEvent> { public nonisolated var events: AsyncCompactMapSequence<AsyncStream<RawInotifyEvent>, InotifyEvent> {
self.eventStream.compactMap(self.transform(_:)) self.eventStream.compactMap(self.transform(_:))
} }