mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-24 00:14:06 +00:00
clean code:remove mdx runnable
This commit is contained in:
parent
c34bde252e
commit
fc0b33181c
31
mdx.cc
31
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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue