Преглед на файлове

in the case where there is a timeout, we should attempt again

Eric Balsa преди 3 месеца
родител
ревизия
b3c50fc411
променени са 1 файла, в които са добавени 6 реда и са изтрити 1 реда
  1. 6 1
      v4l2/syscalls.go

+ 6 - 1
v4l2/syscalls.go

@@ -98,11 +98,16 @@ func WaitForRead(dev Device) <-chan struct{} {
 			fdsRead.Zero()
 			fdsRead.Zero()
 			fdsRead.Set(int(fd))
 			fdsRead.Set(int(fd))
 			tv := sys.Timeval{Sec: 2, Usec: 0}
 			tv := sys.Timeval{Sec: 2, Usec: 0}
-			_, errno := sys.Select(int(fd+1), &fdsRead, nil, nil, &tv)
+			n, errno := sys.Select(int(fd+1), &fdsRead, nil, nil, &tv)
 			if errno == sys.EINTR {
 			if errno == sys.EINTR {
 				continue
 				continue
 			}
 			}
 
 
+			if n == 0 {
+				// timeout, no data available
+				continue
+			}
+
 			sigChan <- struct{}{}
 			sigChan <- struct{}{}
 		}
 		}
 	}(dev.Fd())
 	}(dev.Fd())