Results 1 to 2 of 2

Thread: How to make global signals for multi thread?

  1. #1
    Join Date
    Mar 2013
    Posts
    28
    Thanks
    13
    Qt products
    Qt4
    Platforms
    Windows

    Default How to make global signals for multi thread?

    I need a signal which can pass messages between threads, while when the message is sent the receiver may be executing a loop. For example, when a thread is doing a while loop I need it stop as soon as it knows.
    The only way I can tell is making a variant accessable to the threads and protected by a mutex. It doesn't have to be complex, just a bool or int will do.
    Well I don't think I can use signal/slot because in a while loop the slot won't be called.
    I want to know if there is a more specialized class in Qt which can do this work.
    Thanks in advance!

  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: How to make global signals for multi thread?

    Quote Originally Posted by hind View Post
    I want to know if there is a more specialized class in Qt which can do this work.
    No, there is no such thing. Either you're using an event loop (in which case you can just use events to do what you want) or you're using a simple while loop in which case you're on your own.
    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.


Similar Threads

  1. Replies: 6
    Last Post: 29th April 2011, 15:22
  2. Replies: 5
    Last Post: 22nd February 2011, 21:21
  3. How to make all-files-global variable?
    By hakermania in forum Newbie
    Replies: 32
    Last Post: 29th December 2010, 18:05
  4. How can I make an object global?
    By Awareness in forum Newbie
    Replies: 10
    Last Post: 27th March 2010, 05:32
  5. QThread - multi threaded signals and slots
    By rishid in forum Qt Programming
    Replies: 4
    Last Post: 30th March 2008, 01:47

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.