This might seem an odd question but I want to be certain I've understood this correctly. In the fsevents manual on FSEventStreamCreate():
Creates a new FS event stream object with the given parameters. In order to start receiving callbacks you must also call FSEventStreamScheduleWithRunLoop() and FSEventStreamStart().
...
sinceWhen: The service will supply events that have happened after the given event ID. To ask for events "since now" pass the constant kFSEventStreamEventIdSinceNow. Often, clients will supply the highest-numbered FSEventStreamEventId they have received in a callback, which they can obtain via the FSEventStreamGetLatestEventId() accessor. Do not pass zero for sinceWhen, unless you want to receive events for every directory modified since "the beginning of time" -- an unlikely scenario. ...
Does "since now" mean from the FSEventStreamCreate, or from the FSEventStreamStart call?
At a high level, I want to register a stream and then kick off a process which will modify a file at really at sporadic intervals. The monitor must not miss a modification between the the start of processing the file and the start of the stream or it could be minutes or hours before the next modification.
So I have two threads:
- call FSEventStreamCreate()
- start a separate thread which will:
- call FSEventStreamScheduleWithRunLoop()
- call FSEventStreamStart()
- call CFRunLoopRun()
- kick off file processing
Depending on interpretation, this threading model might be perfectly safe or have a race condition where the stream starts with FSEventStreamStart() call and occurs after file processing starts.