in wrap.go [214:243]
func (es *EventStream) start(paths []string, callbackInfo uintptr) {
since := eventIDSinceNow
if es.Resume {
since = es.EventID
}
es.stream = setupStream(paths, es.Flags, callbackInfo, since, es.Latency, es.Device)
started := make(chan struct{})
go func() {
runtime.LockOSThread()
es.rlref = CFRunLoopRef(C.CFRunLoopGetCurrent())
C.CFRetain(C.CFTypeRef(es.rlref))
C.FSEventStreamScheduleWithRunLoop(es.stream, C.CFRunLoopRef(es.rlref), C.kCFRunLoopDefaultMode)
C.FSEventStreamStart(es.stream)
close(started)
C.CFRunLoopRun()
}()
if !es.hasFinalizer {
// TODO: There is no guarantee this run before program exit
// and could result in panics at exit.
runtime.SetFinalizer(es, finalizer)
es.hasFinalizer = true
}
<-started
}