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();
}
Пример #2
0
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();
    }
}