OK: I'm implementing File Sharing in an iPhone OS app, and of course this means filesystem monitoring. Yay!
Basically, the OS copies and/or deletes from and to a directory I can access when the user manipulates files into my app's section in iTunes. Thus, I need to monitor the directory for changes presumably via an efficient mechanism like a kqueue()
.
How do I implement this so that I know that the files have finished copying? I was thinking along the lines of:
- Monitor with
kqueue()
. - At event, start (or reset existing) timeout.
- When timeout elapses, do work.
but is there a better way of doing it that ensures I'm not stepping over the OS's toes?