site_archiver@lists.apple.com Delivered-To: darwin-dev@lists.apple.com Le 5 mai 09 à 22:04, Mark Gilbert a écrit : Folks. The key issues seem to be: _______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-dev mailing list (Darwin-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-dev/site_archiver%40lists.appl... For the 3rd time in my life I am about to start writing folder watching code. It's one of those things thats easy to do in a half hearted manner, but somewhat complicated to do in an efficient and comprehensive way. I thought I might canvas some ideas from other people before I embark on this next generation. - What are we watching for ? - new files, changed files ? renamed files ? - How do we find them ? - bulk search, iteration ? - How do we know which ones have already been processed ? - mod date ? some kind of flag ? - How do we know when its safe to 'trigger' on a file which is being written into the folder ? - What happens as our folder gets full up....? - How do we do all this efficiently without hammering the file system or the CPU ? I have my own ideas on some of these things, but I wanted to see if anyone else had a strong point of view. In particular whether its a good plan to mark files in some way, and whether this can be keyed automatically into the discovery process. Also, what is the best discovery process ? I am sure Apple would tell us to use event notifications rather than polling the folder, but I have not had much luck figuring out what can be notified and how. I can give you an answer at least about notifications. You can use either the FSEvent API or kevent/kqueue API (or a launchd task and let launchd watching the folder for you). This email sent to site_archiver@lists.apple.com