Results 1 to 17 of 17

Thread: Producer Consumer

Hybrid View

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

    Default Re: Producer Consumer

    Quote Originally Posted by ^NyAw^ View Post
    If I comment all the Processing code, the Threads work correctly but uncommenting this part of the code, the Thread hangs.
    Do you access any shared data or GUI there?

  2. #2
    Join Date
    Jan 2006
    Location
    Sta. Eugènia de Berga (Vic - Barcelona - Spain)
    Posts
    869
    Thanks
    70
    Thanked 59 Times in 57 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Producer Consumer

    Hi,
    Do you access any shared data or GUI there?
    I access to the buffer of images to process it, then every tool (image processing tool) process the corresponding image and finally it paints to a Widget. The Widget is contains a Window (mmm... the processing library has a window object that I used to create a Widget) creating the library window into the widget and telling it that the Widget is its father.

    If I process the image but don't display it, I'm able to stop and start the program as I want to, but if I display the images into the Widget and try to stop the program it hangs.

    The code of the Widget is executed by the Consumer Thread. It Process the image, take the result image and display it.

    The Widget is in the Main Window.

    I will investigate more, and thanks for thinking on it
    Òscar Llarch i Galán

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

    Default Re: Producer Consumer

    Quote Originally Posted by ^NyAw^ View Post
    The code of the Widget is executed by the Consumer Thread. It Process the image, take the result image and display it.
    And that's the problem. Only the main thread (a.k.a. the GUI thread) can touch the GUI. Better send those QImages through a queued connection to the GUI thread and let it handle them.

    Also read this carefully: http://doc.trolltech.com/4.2/threads.html
    Last edited by jacek; 17th November 2006 at 20:04. Reason: spelling error

  4. #4
    Join Date
    Jan 2006
    Location
    Sta. Eugènia de Berga (Vic - Barcelona - Spain)
    Posts
    869
    Thanks
    70
    Thanked 59 Times in 57 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Smile Re: Producer Consumer

    Hey,
    I will take a look at it.

    Thank you very much,
    Òscar Llarch i Galán

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.