Results 1 to 7 of 7

Thread: signal and slot across threads having event loop

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Aug 2006
    Location
    Madison, WI USA
    Posts
    153
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    35
    Thanked 1 Time in 1 Post

    Default Re: signal and slot across threads having event loop

    Originally Posted by jacek
    ...but you have to pass the ownership as well.
    Jacek, what do you mean by this?

    Unless the pointer is const, cannot the slot alter the data pointed at, or even delete the pointer?

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    28
    Thanked 976 Times in 912 Posts

    Default Re: signal and slot across threads having event loop

    Quote Originally Posted by mclark View Post
    Jacek, what do you mean by this?
    If you pass a pointer to another thread, it should become responsible for deleting it and the sender thread shouldn't have any access to that object anymore (unless you use proper locking mechanisms). You don't want any race conditions.

  3. The following user says thank you to jacek for this useful post:

    mclark (5th November 2007)

  4. #3
    Join Date
    Aug 2006
    Location
    Madison, WI USA
    Posts
    153
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    35
    Thanked 1 Time in 1 Post

    Default Re: signal and slot across threads having event loop

    Thanks jacek, I thought maybe there was some implicit Qt way to guarantee the ownership swap. But, I see you mean this is the responsibility of the programmer.

    BTW, thanks for the quick reply!

Similar Threads

  1. Workload in a QThread blocks main application's event loop ?
    By 0xBulbizarre in forum Qt Programming
    Replies: 14
    Last Post: 9th April 2006, 21:55
  2. signal slot conection using a string, not a SLOT
    By rianquinn in forum Qt Programming
    Replies: 6
    Last Post: 5th February 2006, 18:52
  3. Replies: 4
    Last Post: 23rd January 2006, 16:51

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.