示例#1
0
// Stop listening to the event stream.
func (es *EventStream) Stop() {
	if es.stream != nil {
		C.FSEventStreamStop(es.stream)
		C.FSEventStreamInvalidate(es.stream)
		C.FSEventStreamRelease(es.stream)
		C.CFRunLoopStop(es.rlref)
	}
	es.stream = nil
}
示例#2
0
// Stop listening to the event stream.
func (es *EventStream) Stop() {
	if es.stream != nil {
		C.FSEventStreamStop(es.stream)
		C.FSEventStreamInvalidate(es.stream)
		C.FSEventStreamRelease(es.stream)
		C.CFRunLoopStop(es.rlref)
		registry.Delete(es.registryID)
	}
	es.stream = nil
	es.registryID = 0
}
示例#3
0
func (w *Watcher) removeWatch(path string) error {
	w.wmut.Lock()
	stream, found := w.watches[path]
	w.wmut.Unlock()

	if found {
		C.FSEventStreamStop(stream)
		C.FSEventStreamInvalidate(stream)
		C.FSEventStreamRelease(stream)
		w.wmut.Lock()
		delete(w.watches, path)
		w.wmut.Unlock()
	}

	return nil
}
示例#4
0
// Releases all resources and closes the channel
// https://developer.apple.com/library/mac/documentation/Darwin/Reference/FSEvents_Ref/Reference/reference.html#jumpTo_16
func (s Stream) release() {
	C.FSEventStreamRelease(s.cstream)
	C.CFRunLoopStop(s.runloop)
}