Results 1 to 8 of 8

Thread: God! QSocketNotifier emit the activated signal endlessly

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Apr 2010
    Posts
    2
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default Re: God! QSocketNotifier emit the activated signal endlessly

    Ok, I learned now, that the problem has to do with the thread usage in my case: I learned, that the SLOT(rxEvent()) is processed in the event loop of the core application whilst the SIGNAL(activated) is emitted in the thread. This is solved by changing the thread affinitiy of the slot by calling moveToThisThread() in the core application.
    Qt Code:
    1. ReceiverThread *receiverThread = new ReceiverThread();
    2. app.connect(receiverThread, SIGNAL(finished()), &app, SLOT(quit()));
    3. receiverThread->moveToThread(receiverThread);
    4. receiverThread->start();
    To copy to clipboard, switch view to plain text mode 

    So using Qt::BlockingQueuedConnection is a bad idea in this case.

    The doc of moveToThisThread() provides a god explaination.

    Cheers

  2. #2
    Join Date
    Jul 2013
    Posts
    33
    Qt products
    Qt3
    Platforms
    Unix/X11

    Default Re: God! QSocketNotifier emit the activated signal endlessly

    I tto face same issue where slot is called continuously even when i run in different thread.How do i overcome this ? Can anybody suggest me a proper answer to close this ASAP


    Regards
    Bala B

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

    Default Re: God! QSocketNotifier emit the activated signal endlessly

    Did you try code from the previous post?
    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.


  4. #4
    Join Date
    Jul 2013
    Posts
    33
    Qt products
    Qt3
    Platforms
    Unix/X11

    Default Re: God! QSocketNotifier emit the activated signal endlessly

    yeah..but still i get the activated signal continuously in that thread as well

Similar Threads

  1. emit qt signal is very slow how it can be optimized?
    By sawerset in forum Qt Programming
    Replies: 8
    Last Post: 30th December 2008, 09:21
  2. pthread instead QThread
    By brevleq in forum Qt Programming
    Replies: 8
    Last Post: 23rd December 2008, 07:16
  3. Connection of custon signals/slots
    By brevleq in forum Qt Programming
    Replies: 2
    Last Post: 23rd December 2008, 07:04
  4. how to know which button emit the signal?
    By coder1985 in forum Qt Programming
    Replies: 2
    Last Post: 12th January 2008, 14:26
  5. emit the activated signal on a combobox
    By Equilibrium in forum Qt Programming
    Replies: 4
    Last Post: 8th November 2007, 12:33

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
  •  
Qt is a trademark of The Qt Company.