Created
September 24, 2017 10:54
-
-
Save syossan27/be8a1e9dfa25c74a064fbf137c293b0e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // NewWatcher establishes a new watcher with the underlying OS and begins waiting for events. | |
| func NewWatcher() (*Watcher, error) { | |
| kq, err := kqueue() | |
| if err != nil { | |
| return nil, err | |
| } | |
| w := &Watcher{ | |
| kq: kq, | |
| watches: make(map[string]int), | |
| dirFlags: make(map[string]uint32), | |
| paths: make(map[int]pathInfo), | |
| fileExists: make(map[string]bool), | |
| externalWatches: make(map[string]bool), | |
| Events: make(chan Event), | |
| Errors: make(chan error), | |
| done: make(chan bool), | |
| } | |
| go w.readEvents() | |
| return w, nil | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment