From e6ebd8ec9ebe9f9532dae226dd76a8709189e202 Mon Sep 17 00:00:00 2001 From: zhangzihao Date: Sat, 23 Jan 2021 11:32:18 +0800 Subject: [PATCH] Changed _exit to exit. --- libsearch/index/first-index.cpp | 2 +- libsearch/index/inotify-index.cpp | 6 +++--- src/main.cpp | 10 +++++++++- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/libsearch/index/first-index.cpp b/libsearch/index/first-index.cpp index 587e005..03a450b 100644 --- a/libsearch/index/first-index.cpp +++ b/libsearch/index/first-index.cpp @@ -151,7 +151,7 @@ void FirstIndex::run(){ mutex1.unlock(); mutex2.unlock(); mutex3.unlock(); - _exit(0); + ::exit(0); diff --git a/libsearch/index/inotify-index.cpp b/libsearch/index/inotify-index.cpp index 19b2df6..232e185 100644 --- a/libsearch/index/inotify-index.cpp +++ b/libsearch/index/inotify-index.cpp @@ -353,7 +353,7 @@ fork: } else if ( rc == 0 ) { qDebug() << "select timeout!"; - _exit(0); + ::exit(0); }else{ numRead = read(m_fd, buf, BUF_LEN); if (numRead == -1){ @@ -375,7 +375,7 @@ fork: //MouseZhangZh // connect(liveTime, &QTimer::timeout, [ = ](){ -//// _exit(0); +//// ::exit(0); // *b_timeout = 1; // }); // for (;;){ @@ -384,7 +384,7 @@ fork: // this->eventProcess(buf, numRead); // if (liveTime->remainingTime() < 1){ // qDebug() << "liveTime->remainingTime():" << liveTime->remainingTime(); -// _exit(0); +// ::exit(0); // } // } } diff --git a/src/main.cpp b/src/main.cpp index 13aaa9f..cc5a436 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -36,15 +36,23 @@ void handler(int){ qDebug() << "Recieved SIGTERM!"; + + + GlobalSettings::getInstance()->setValue(INDEX_DATABASE_STATE, "2"); GlobalSettings::getInstance()->setValue(CONTENT_INDEX_DATABASE_STATE, "2"); GlobalSettings::getInstance()->setValue(INDEX_GENERATOR_NORMAL_EXIT, "2"); GlobalSettings::getInstance()->setValue(INOTIFY_NORMAL_EXIT, "2"); + GlobalSettings::getInstance()->forceSync(INDEX_DATABASE_STATE); + GlobalSettings::getInstance()->forceSync(CONTENT_INDEX_DATABASE_STATE); + GlobalSettings::getInstance()->forceSync(INDEX_GENERATOR_NORMAL_EXIT); + GlobalSettings::getInstance()->forceSync(INOTIFY_NORMAL_EXIT); qDebug() << "indexDataBaseStatus: " << GlobalSettings::getInstance()->getValue(INDEX_DATABASE_STATE).toString(); qDebug() << "contentIndexDataBaseStatus: " << GlobalSettings::getInstance()->getValue(CONTENT_INDEX_DATABASE_STATE).toString(); - _exit(0); + + ::exit(0); // InotifyIndex::getInstance("/home")->~InotifyIndex();