From fc0b33181cb30f86f9edb6b0ba59eb9123d324dc Mon Sep 17 00:00:00 2001 From: xiaoyifang Date: Mon, 18 Apr 2022 22:23:48 +0800 Subject: [PATCH] clean code:remove mdx runnable --- mdx.cc | 31 ------------------------------- 1 file changed, 31 deletions(-) diff --git a/mdx.cc b/mdx.cc index 7eb823f3..532c9649 100644 --- a/mdx.cc +++ b/mdx.cc @@ -252,7 +252,6 @@ class MdxDictionary: public BtreeIndexing::BtreeDictionary QAtomicInt deferredInitDone; Mutex deferredInitMutex; bool deferredInitRunnableStarted; - QSemaphore deferredInitRunnableExited; string initError; QString cacheDirName; @@ -400,10 +399,6 @@ MdxDictionary::~MdxDictionary() { Mutex::Lock _( deferredInitMutex ); - // Wait for init runnable to complete if it was ever started -// if ( deferredInitRunnableStarted ) -// deferredInitRunnableExited.acquire(); - dictFile.close(); removeDirectory( cacheDirName ); @@ -411,29 +406,6 @@ MdxDictionary::~MdxDictionary() //////// MdxDictionary::deferredInit() -class MdxDeferredInitRunnable: public QRunnable -{ - MdxDictionary & dictionary; - QSemaphore & hasExited; - -public: - - MdxDeferredInitRunnable( MdxDictionary & dictionary_, - QSemaphore & hasExited_ ): - dictionary( dictionary_ ), hasExited( hasExited_ ) - {} - - ~MdxDeferredInitRunnable() - { - hasExited.release(); - } - - virtual void run() - { - dictionary.doDeferredInit(); - } -}; - void MdxDictionary::deferredInit() { if ( !Utils::AtomicInt::loadAcquire( deferredInitDone ) ) @@ -445,9 +417,6 @@ void MdxDictionary::deferredInit() if ( !deferredInitRunnableStarted ) { - // QThreadPool::globalInstance()->start( - // new MdxDeferredInitRunnable( *this, deferredInitRunnableExited ), - // -1000 ); QThreadPool::globalInstance()->start( [ this ]() { this->doDeferredInit(); },-1000 ); deferredInitRunnableStarted = true; }