Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Threads locked in QtThreadPool when using QFuture
Forum Updated to NodeBB v4.3 + New Features

Threads locked in QtThreadPool when using QFuture

Scheduled Pinned Locked Moved General and Desktop
1 Posts 1 Posters 1.2k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Z Offline
    Z Offline
    zorn
    wrote on last edited by
    #1

    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 !

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved