func (w *Watcher) wakeupReader() error { e := syscall.PostQueuedCompletionStatus(w.port, 0, 0, nil) if e != nil { return os.NewSyscallError("PostQueuedCompletionStatus", e) } return nil }
// Close resets the whole watcher object, closes all existing file descriptors, // and sends stateCPClose state as completion key to the main watcher's loop. func (r *readdcw) Close() (err error) { r.Lock() if !r.start { r.Unlock() return nil } for _, wd := range r.m { wd.filter &^= onlyMachineStates wd.filter |= stateCPClose if e := wd.closeHandle(); e != nil && err == nil { err = e } } r.start = false r.Unlock() r.wg.Add(1) if e := syscall.PostQueuedCompletionStatus(r.cph, 0, stateCPClose, nil); e != nil && err == nil { return e } r.wg.Wait() return }