Results 1 to 3 of 3

Thread: QtService stop Subthreads

  1. #1
    Join Date
    Jan 2014
    Posts
    8
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default QtService stop Subthreads

    Hi,

    I have an application using QtService and a Worker-Class with a couple of Subthreads. Now I have a Problem that I'm not sure how to wait in the Service-Stop funtion that all Subthreads are ended. I tried it in the way:

    QEventLoop loop;
    loop.connect(&thread, SIGNAL(finished()), SLOT(quit()));
    loop.exec();

    where "thread" is the thread Controlling the main-Workerclass. It is stopped when the last Subthtread is finished. This works okay. But in the Servcie the end of the QEventLoop is never reached. Is my way completly wrong?

    Thanks and regards,
    Willi

  2. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: QtService stop Subthreads

    Have you told the thread to stop or are you just assuming that it will?

  3. #3
    Join Date
    Jan 2014
    Posts
    8
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default Re: QtService stop Subthreads

    Yes, I told all threads to Exit. But I found the Problem. One of the threads did not Exit properly. So the way to wait in the stop()-function of the QtService is fine.

    Thx!

Similar Threads

  1. QtService & QtSql
    By acedanans in forum Qt Programming
    Replies: 11
    Last Post: 3rd October 2014, 12:30
  2. QTservice stop() problem
    By caysee_yo in forum Qt Programming
    Replies: 1
    Last Post: 17th April 2013, 19:33
  3. QtSingleApplication, QtService and Qt5
    By mentalmushroom in forum Qt Programming
    Replies: 1
    Last Post: 28th December 2012, 14:20
  4. Was QtService deprecated in Qt4.8
    By learning_qt in forum Qt Programming
    Replies: 1
    Last Post: 8th November 2012, 10:30
  5. How to use QtService class with Qt 4.7.4
    By Qting in forum Qt Programming
    Replies: 3
    Last Post: 4th February 2012, 11:42

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.