func (t *trg) send(evn []event) {
	for i := range evn {
		t.c <- &evn[i]
	}
}
send reported events one by one through chan.
package notify
import (
	"fmt"
	"os"
	"path/filepath"
	"strings"
	"sync"
	"syscall"
)
type trigger interface {
	Close() error
	Stop() error
	NewWatched(string, os.FileInfo) (*watched, error)
	Record(*watched)
	Del(*watched)
	Watched(interface{}) (*watched, int64, error)
	Init() error
	Watch(os.FileInfo, *watched, int64) error
	Unwatch(*watched) error
	Wait() (interface{}, error)
	IsStop(n interface{}, err error) bool
}
type trgWatched struct {
	p string
	fi os.FileInfo
	eDir Event
	eNonDir Event
}
var encode func(Event, bool) int64
var (
	nat2not map[Event]Event
	not2nat map[Event]Event
)
type trg struct {
	sync.Mutex
	s chan struct{}
	c chan<- EventInfo
	pthLkp map[string]*watched
	t trigger
}
func newWatcher(c chan<- EventInfo) watcher {
	t := &trg{
		s:      make(chan struct{}, 1),
		pthLkp: make(map[string]*watched, 0),
		c:      c,
	}
	t.t = newTrigger(t.pthLkp)
	if err := t.t.Init(); err != nil {
		t.Close()
		return watcherStub{fmt.Errorf("failed setting up watcher: %v", err)}
	}
	go t.monitor()
	return t
}
func (t *trg) Close() (err error) {
	t.Lock()
	if err = t.t.Stop(); err != nil {
		t.Unlock()
		return
	}
	<-t.s
	var e error
	for _, w := range t.pthLkp {
		if e = t.unwatch(w.p, w.fi); e != nil {
			dbgprintf("trg: unwatch %q failed: %q\n", w.p, e)
			err = nonil(err, e)
		}
	}
	if e = t.t.Close(); e != nil {
		dbgprintf("trg: closing native watch failed: %q\n", e)
		err = nonil(err, e)
	}
	if remaining := len(t.pthLkp); remaining != 0 {
		err = nonil(err, fmt.Errorf("Not all watches were removed: len(t.pthLkp) == %v", len(t.pthLkp)))
	}
	t.Unlock()
	return
}