]> go.fuhry.dev Git - fsnotify.git/commitdiff
Linux - Remove Select() syscall for now
authorChris Howey <chris@howey.me>
Wed, 3 Jul 2013 12:47:43 +0000 (07:47 -0500)
committerChris Howey <chris@howey.me>
Wed, 3 Jul 2013 12:47:43 +0000 (07:47 -0500)
Needs more testing, getting reports from users of no new events
on some Linux systems after adding Select() call.

fsnotify_linux.go

index 2ee1d4dd477d40f58b9b21df5f86e46058e593df..ff2f235d0d09fd39dac5ed6534a298bdda672ab3 100644 (file)
@@ -203,18 +203,7 @@ func (w *Watcher) readEvents() {
                errno error                                   // Syscall errno
        )
 
-       rfds := &syscall.FdSet{}
-       timeout := &syscall.Timeval{}
-
        for {
-               // Select to see if data available
-               *timeout = syscall.NsecToTimeval(selectWaitTime)
-               FD_ZERO(rfds)
-               FD_SET(rfds, w.fd)
-               if _, errno = syscall.Select(w.fd+1, rfds, nil, nil, timeout); errno != nil {
-                       w.Error <- os.NewSyscallError("select", errno)
-               }
-
                // See if there is a message on the "done" channel
                select {
                case <-w.done:
@@ -225,12 +214,7 @@ func (w *Watcher) readEvents() {
                default:
                }
 
-               // Check select result to see if Read will block, only read if no blocking.
-               if FD_ISSET(rfds, w.fd) {
                        n, errno = syscall.Read(w.fd, buf[0:])
-               } else {
-                       continue
-               }
 
                // If EOF is received
                if n == 0 {