Fix:Index init failed sometimes.
This commit is contained in:
parent
c2905bc331
commit
8e3855e95a
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue