Results 1 to 3 of 3

Thread: multi threads

  1. #1
    Join Date
    Mar 2009
    Location
    Gansu,China
    Posts
    188
    Qt products
    Qt4
    Platforms
    Windows

    Default multi threads

    Hello,evry one.
    When I create two threads and shared a class.In the class,I synchronize the method (with
    Qt Code:
    1. QMutexLocker locker(&mutex);
    To copy to clipboard, switch view to plain text mode 
    ) used by the threads,I find that does not speed up the progress on the dual-core CPU.Does not synchronization speed up the progress in the multi-threads?

  2. #2
    Join Date
    Mar 2009
    Location
    Gansu,China
    Posts
    188
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: multi threads

    When Synchronizing the threads,I did as follows,Am I right or not?
    Qt Code:
    1. Class A
    2. {
    3. public:
    4. void caculate()
    5. {
    6. QMutexLocker locker(&mutex);
    7. ....
    8. }
    9. public:
    10. mutable QMutex mutex;
    11. }
    To copy to clipboard, switch view to plain text mode 

  3. #3
    Join Date
    Mar 2009
    Location
    Gansu,China
    Posts
    188
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: multi threads

    please answer my question.

Similar Threads

  1. Replies: 8
    Last Post: 27th March 2013, 11:51
  2. Why do some QWidgets create own threads?
    By donglebob in forum Qt Programming
    Replies: 5
    Last Post: 6th July 2010, 17:01
  3. qt multi threads
    By weixj2003ld in forum Qt Programming
    Replies: 20
    Last Post: 8th April 2009, 13:05
  4. No context switch between Threads and parent ?
    By donglebob in forum Qt Programming
    Replies: 15
    Last Post: 29th October 2008, 22:49

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.