Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QIODevice on other thread than MAIN
Forum Updated to NodeBB v4.3 + New Features

QIODevice on other thread than MAIN

Scheduled Pinned Locked Moved General and Desktop
4 Posts 3 Posters 5.1k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Algirdasss
    wrote on last edited by
    #1

    Hy,

    in ICS i found some quite old (year 2003 i think) whitepaper about QT application performance. There was interesting recommendation about threading and classes that derive from QIODevice:

    bq. Never create QWidget or QIODevice subclasses from any thread other than the main
    thread.

    Is this true for current versions of QT? Target OS'es are Linux and Windows. Thanks indeed

    1 Reply Last reply
    1
    • F Offline
      F Offline
      Franzk
      wrote on last edited by
      #2

      QWidget derived classes should be only used in one single thread (does not necessarily have to be the main thread). I'm not sure why QIODevices should not be used in threads. QFile is a QIODevice and I'm pretty sure someone has to do some threaded file handling somewhere.

      Did the whitepaper state why QIODevices should not be used outside the main thread?

      "Horse sense is the thing a horse has which keeps it from betting on people." -- W.C. Fields

      http://www.catb.org/~esr/faqs/smart-questions.html

      1 Reply Last reply
      0
      • F Offline
        F Offline
        Felix
        wrote on last edited by
        #3

        could you post the whitepaper for us? might be intressting for some more people.

        1 Reply Last reply
        0
        • A Offline
          A Offline
          Algirdasss
          wrote on last edited by
          #4

          Link to whitepapers at ICS:

          "ICS Whitepapers":http://www.ics.com/learning/learning_center_downloads/

          The whitepaper I mention here is named: Turbocharging Qt Applications
          You mus register at ICS in order to download it. Registration is easy an free ...

          Thats what is said about Windows and QT threading in this whitepaper:

          bq. Windows has its problems as well. While the underlying GUI libraries are in theory
          thread-safe (in practice, the so-called “consumer Windows versions” Windows 95/98/ME
          have stability issues with multithreading in GUI programs), memory management
          requires that you do not create any widgets or sockets (or anything else that handles
          operating system events) from any other thread than the main thread.

          I suspect that this applies to old Windows versions (9x). I myself use QUdpSocket at other threads than MAIN in WIN XP ... but I'd like to have some confirmation that it is really safe from someone who knows WIN32 api better than me:) I am trying to search for answer in internet but no results yet. Just found in many places that win socks are thread safe.

          1 Reply Last reply
          1

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved