Closed elgs closed 10 years ago
I have only one instance of the watcher to watch multiple directories now, including the recursive sub directories. Looks like it works without any problem. By the way, currently I have moved my fsnotify related project from Mac to Linux (in Parallels). Everything seems to be perfect on Linux, however, the one on Mac is not usable now.
I finally chose multiple instances for the reason that if I use only one instance, anything happens in any watched directory will trigger the watcher. This itself is not a problem. However, the reality is that I share the same watcher in multiple goroutines, but I don't want all goroutines to be alerted if only one watched changes. So I finally decided to get each goroutine own its own watcher.
If I have multiple directories to watch, the directories may be physically located across different disks, or partitions? Should I use only one instance of
watcher
, created bywatcher, _ := fsnotify.NewWatcher()
, or should I create separatewatcher
s for each directory?Thanks, Elgs