A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/fsnotify/fsnotify/commit/10e144023ee0d6da2b589d0cb767c06d0c3d5cdb below:

remove fsnFlags, purgeEvents and internalEvent channel · fsnotify/fsnotify@10e1440 · GitHub

@@ -63,8 +63,6 @@ type Watcher struct {

63 63

kq int // File descriptor (as returned by the kqueue() syscall)

64 64

watches map[string]int // Map of watched file descriptors (key: path)

65 65

wmut sync.Mutex // Protects access to watches.

66 -

fsnFlags map[string]uint32 // Map of watched files to flags used for filter

67 -

fsnmut sync.Mutex // Protects access to fsnFlags.

68 66

enFlags map[string]uint32 // Map of watched files to evfilt note flags used in kqueue

69 67

enmut sync.Mutex // Protects access to enFlags.

70 68

paths map[int]string // Map of watched paths (key: watch descriptor)

@@ -75,7 +73,6 @@ type Watcher struct {

75 73

externalWatches map[string]bool // Map of watches added by user of the library.

76 74

ewmut sync.Mutex // Protects access to externalWatches.

77 75

Error chan error // Errors are sent on this channel

78 -

internalEvent chan *FileEvent // Events are queued on this channel

79 76

Event chan *FileEvent // Events are returned on this channel

80 77

done chan bool // Channel for sending a "quit message" to the reader goroutine

81 78

isClosed bool // Set to true when Close() is first called

@@ -92,20 +89,17 @@ func NewWatcher() (*Watcher, error) {

92 89

w := &Watcher{

93 90

kq: fd,

94 91

watches: make(map[string]int),

95 -

fsnFlags: make(map[string]uint32),

96 92

enFlags: make(map[string]uint32),

97 93

paths: make(map[int]string),

98 94

finfo: make(map[int]os.FileInfo),

99 95

fileExists: make(map[string]bool),

100 96

externalWatches: make(map[string]bool),

101 -

internalEvent: make(chan *FileEvent),

102 97

Event: make(chan *FileEvent),

103 98

Error: make(chan error),

104 99

done: make(chan bool, 1),

105 100

}

106 101 107 102

go w.readEvents()

108 -

go w.purgeEvents()

109 103

return w, nil

110 104

}

111 105

@@ -323,7 +317,7 @@ func (w *Watcher) readEvents() {

323 317

if errno != nil {

324 318

w.Error <- os.NewSyscallError("close", errno)

325 319

}

326 -

close(w.internalEvent)

320 +

close(w.Event)

327 321

close(w.Error)

328 322

return

329 323

}

@@ -369,7 +363,7 @@ func (w *Watcher) readEvents() {

369 363

w.sendDirectoryChangeEvents(fileEvent.Name)

370 364

} else {

371 365

// Send the event on the events channel

372 -

w.internalEvent <- fileEvent

366 +

w.Event <- fileEvent

373 367

}

374 368 375 369

// Move to next event

@@ -419,15 +413,6 @@ func (w *Watcher) watchDirectoryFiles(dirPath string) error {

419 413

for _, fileInfo := range files {

420 414

filePath := filepath.Join(dirPath, fileInfo.Name())

421 415 422 -

// Inherit fsnFlags from parent directory

423 -

w.fsnmut.Lock()

424 -

if flags, found := w.fsnFlags[dirPath]; found {

425 -

w.fsnFlags[filePath] = flags

426 -

} else {

427 -

w.fsnFlags[filePath] = FSN_ALL

428 -

}

429 -

w.fsnmut.Unlock()

430 - 431 416

if fileInfo.IsDir() == false {

432 417

// Watch file to mimic linux fsnotify

433 418

e := w.addWatch(filePath, sys_NOTE_ALLEVENTS)

@@ -477,20 +462,11 @@ func (w *Watcher) sendDirectoryChangeEvents(dirPath string) {

477 462

_, doesExist := w.fileExists[filePath]

478 463

w.femut.Unlock()

479 464

if !doesExist {

480 -

// Inherit fsnFlags from parent directory

481 -

w.fsnmut.Lock()

482 -

if flags, found := w.fsnFlags[dirPath]; found {

483 -

w.fsnFlags[filePath] = flags

484 -

} else {

485 -

w.fsnFlags[filePath] = FSN_ALL

486 -

}

487 -

w.fsnmut.Unlock()

488 - 489 465

// Send create event

490 466

fileEvent := new(FileEvent)

491 467

fileEvent.Name = filePath

492 468

fileEvent.create = true

493 -

w.internalEvent <- fileEvent

469 +

w.Event <- fileEvent

494 470

}

495 471

w.femut.Lock()

496 472

w.fileExists[filePath] = true


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4