RFR: 8293067: (fs) Implement WatchService using system library (macOS) [v3]

Maxim Kartashev mkartashev at openjdk.org
Thu Sep 22 08:01:23 UTC 2022


On Tue, 20 Sep 2022 21:05:31 GMT, Brian Burkhalter <bpb at openjdk.org> wrote:

>> Maxim Kartashev has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Removed the change unnecessary without recursive watch
>
> src/java.base/macosx/native/libnio/fs/MacOSXWatchService.c line 199:
> 
>> 197: 
>> 198:     FSEventStreamStop(streamRef);       // Unregister with the FS Events service.
>> 199:                                         // No more callbacks from this stream.
> 
> Does `FSEventStreamUnscheduleFromRunLoop()` need to be called here?

I think not. The [documentation](https://developer.apple.com/documentation/coreservices/1446990-fseventstreaminvalidate?language=objc) for `FSEventStreamInvalidate()` that gets called immediately after this line states the following:
> Invalidates the stream, like CFRunLoopSourceInvalidate() does for a CFRunLoopSourceRef. It will be unscheduled  from any runloops or dispatch queues upon which it had been scheduled.

So calling `FSEventStreamUnscheduleFromRunLoop()` seems superfluous; its semantics is described as
> ... removes the stream from the specified run loop, like CFRunLoopRemoveSource() does for a CFRunLoopSourceRef.

-------------

PR: https://git.openjdk.org/jdk/pull/10140


More information about the nio-dev mailing list