From 8e3855e95a4c9c50a095000cfd68cf96cf034e6b Mon Sep 17 00:00:00 2001 From: iaom Date: Wed, 3 Nov 2021 17:11:20 +0800 Subject: [PATCH] Fix:Index init failed sometimes. --- libsearch/index/inotify-watch.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libsearch/index/inotify-watch.cpp b/libsearch/index/inotify-watch.cpp index 43b36a7..b36e705 100644 --- a/libsearch/index/inotify-watch.cpp +++ b/libsearch/index/inotify-watch.cpp @@ -180,6 +180,7 @@ void InotifyWatch::run() int rc; rc = select(m_inotifyFd + 1, &fds, NULL, NULL, NULL); if(rc > 0) { + ++FileUtils::_index_status; int avail; if (ioctl(m_inotifyFd, FIONREAD, &avail) == EINVAL) { qWarning() << "Did not receive an entire inotify event."; @@ -210,6 +211,7 @@ void InotifyWatch::run() slotEvent(buf, len); free(buf); } + --FileUtils::_index_status; } else if(rc < 0) { // error qWarning() << "select result < 0, error!"; @@ -301,7 +303,6 @@ void InotifyWatch::slotEvent(char *buf, ssize_t len) m_sharedMemory->detach(); currentPath = pathMap; } - --FileUtils::_index_status; } else { assert(false); }