Threads locked in QtThreadPool when using QFuture

  • Hi,
    I have a strange problem when using QFuture.
    My apps is a windows service, and it's happen only after a few day of running.
    I use QtConcurrent::map with a function which query DNS using DnsQuery API from windows.
    After a call to QtConcurrent::map with a list of 2 elements, QthreadPool contains 42 active threads and never decrease.
    here's my log :

    (call to QThreadPool::globalInstance()->activeThreadCount())
    thread pool size: 0
    DNS returned ... for ... in thread 2708
    DNS returned... for ... in thread 3504
    thread pool size: 42

    an exemple of code :
    queryDns(QString name){
    DnsQuery(name.utf16, .....

    start(QList<QString> list)
    m_watcher = new QFutureWatcher<void>();
    connect(m_watcher, SIGNAL(finished()), this, SLOT(finished()));
    m_watcher->setFuture(QtConcurrent::map(list, queryDns));


    so my question is: how is it possible that QtConcurrent create 42 threads for a list of 2 elements ?

    thanks for those whose can help me !

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.