Dispatch Sources
Dispatch Sources
- Subject: Dispatch Sources
- From: Michael Hall <email@hidden>
- Date: Sat, 10 Dec 2016 11:41:14 -0600
I recently asked if anyone had suggestions concerning a seeming kqueue deadlock in writing a OS X native java WatchService.
Someone, I think off-list, did suggest using VDKQueue[1], an updated version of Uli Kusterer’s UKKQueue.
Looking at that the main difference seemed to be that is used GCD for the event notification part.
As a quick test I changed my code to do this…
dispatch_async(dispatch_get_main_queue(),^{
[self postJava:context about:FILE_MODIFIED withWatchKey:watchKey];
});
This didn’t seem to correct the problem.
I did notice that Dispatch Sources[2] seem to be a newer feature that is even more GCD based.
I looked for examples of it’s use…
googling
DISPATCH_SOURCE_TYPE_VNODE filetype:m
There do appear to be examples for directories but as near as I’ve been able to tell in quick scans of the source they only have an open file descriptor for the directory and then sometimes seem to sweep the directory to determine what has changed.
Is this correct? Is this the normal use for this code. You would not have open fd’s for every file in the directory?
Does anyone know of any full fledged file monitors implemented with this that I might of missed in my search? (open source)
Would my chances be decent that using this might avoid the deadlock issues I was running into with kqueue?
[1] https://github.com/bdkjones/VDKQueue <https://github.com/bdkjones/VDKQueue>
[2] https://developer.apple.com/library/content/documentation/General/Conceptual/ConcurrencyProgrammingGuide/GCDWorkQueues/GCDWorkQueues.html#//apple_ref/doc/uid/TP40008091-CH103-SW22 <https://developer.apple.com/library/content/documentation/General/Conceptual/ConcurrencyProgrammingGuide/GCDWorkQueues/GCDWorkQueues.html#//apple_ref/doc/uid/TP40008091-CH103-SW22>
Michael Hall
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden