Enable nonblocking mode in filesystem watcher
authorxushaohua <xushaohua@deepin.com>
Thu, 15 Mar 2018 07:25:56 +0000 (15:25 +0800)
committerxushaohua <xushaohua@deepin.com>
Thu, 15 Mar 2018 07:25:56 +0000 (15:25 +0800)
Change-Id: I525d32660732a8c686fc02ed52639b4338a9c3b6

src/filesystem/dfilesystemwatcher_linux.cpp

index 17fcac37434eca5ae393f5c55b7a740f7f4690dc..4be4b4feb3858fd8385f6b326ad9aef07457f283 100644 (file)
@@ -420,10 +420,10 @@ DFileSystemWatcher::DFileSystemWatcher(QObject *parent)
 {
     int fd = -1;
 #ifdef IN_CLOEXEC
-    fd = inotify_init1(IN_CLOEXEC);
+    fd = inotify_init1(IN_CLOEXEC | O_NONBLOCK);
 #endif
     if (fd == -1) {
-        fd = inotify_init();
+        fd = inotify_init1(O_NONBLOCK);
     }
 
     if (fd != -1)