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. delete/close qtconcurrent thread pool
Forum Updated to NodeBB v4.3 + New Features

delete/close qtconcurrent thread pool

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 4 Posters 972 Views 2 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.
  • S Offline
    S Offline
    s002wjh
    wrote on last edited by s002wjh
    #1

    how would i close/delete the thread pool after finish running

    QFuture<void> future = QtConcurrent::run(...);

    for example one of my sub window GUI are running in qthread pool, but once i close that window, how do i destroy that qthread pool. some kind signal slot ?

    is there anyway to assign an id to thread pool?

    JKSHJ 1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by SGaist
      #2

      Hi,

      Do you mean cancel current request and delete the pool ?

      By the way, why are you running GUI elements in your loop ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      JonBJ 1 Reply Last reply
      1
      • S s002wjh

        how would i close/delete the thread pool after finish running

        QFuture<void> future = QtConcurrent::run(...);

        for example one of my sub window GUI are running in qthread pool, but once i close that window, how do i destroy that qthread pool. some kind signal slot ?

        is there anyway to assign an id to thread pool?

        JKSHJ Offline
        JKSHJ Offline
        JKSH
        Moderators
        wrote on last edited by
        #3

        @s002wjh said in delete/close qtconcurrent thread pool:

        how would i close/delete the thread pool after finish running

        QFuture<void> future = QtConcurrent::run(...);

        Thread pools are designed to last a long time; they are not designed to be closed/deleted.

        You don't need to do anything after you finish with QtConcurrent::run().

        for example one of my sub window GUI are running in qthread pool

        Qt does not allow GUIs to be run in a secondary thread. All GUI classes must be accessed from the GUI thread, which is the thread which created QGuiApplication/QApplication.

        Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

        1 Reply Last reply
        3
        • SGaistS SGaist

          Hi,

          Do you mean cancel current request and delete the pool ?

          By the way, why are you running GUI elements in your loop ?

          JonBJ Offline
          JonBJ Offline
          JonB
          wrote on last edited by
          #4

          @SGaist said in delete/close qtconcurrent thread pool:

          Do you mean cancel current request and delete the poo ?

          Probably an unfortunate turn of phrase... ;-)

          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