void SpellCheckerCore::cancelFutures() { QMutexLocker lock( &d->futureMutex ); /* Iterate the futures and cancel them. */ FutureWatcherMapIter iter = d->futureWatchers.begin(); for( iter = d->futureWatchers.begin(); iter != d->futureWatchers.end(); ++iter ) { iter.key()->future().cancel(); } /* Wait on the futures and delete the futures */ for( iter = d->futureWatchers.begin(); iter != d->futureWatchers.end(); ++iter ) { iter.key()->future().waitForFinished(); delete iter.key(); } d->futureWatchers.clear(); }
void SpellCheckerCore::cancelFutures() { QMutexLocker lock(&d->futureMutex); /* Iterate the futures and cancel them. */ FutureWatcherMapIter iter = d->futureWatchers.begin(); for(iter = d->futureWatchers.begin(); iter != d->futureWatchers.end(); ++iter) { iter.key()->future().cancel(); } }