Results 1 to 4 of 4

Thread: QThreadPool and QRunnable

  1. #1
    Join Date
    May 2008
    Posts
    16
    Thanks
    5
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default QThreadPool and QRunnable

    My current application design uses QThread with signals/slots to communicate to the Main GUI thread. I've just read about QThreadPool and QRunnable as a good way to manage threads without the hassle of maintaining how many threads to use. The question I have though is if it's possible to have event loop using QThreadPool and QRunnable so that I can still support signal/slots ? Thanks for any advice.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QThreadPool and QRunnable

    No, you have no control over the threads there so you can't accept signals in threads running runnables (but you can emit signals from there).
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    May 2008
    Posts
    16
    Thanks
    5
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QThreadPool and QRunnable

    So there's no way I could use QObject subclass such as QTcpSocket and receive the signals within QRunnable subclass, correct? Thanks.

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QThreadPool and QRunnable

    Quote Originally Posted by jimc1200 View Post
    So there's no way I could use QObject subclass such as QTcpSocket and receive the signals within QRunnable subclass, correct? Thanks.
    No, I don't think so.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.