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. QDebug() Thread Safe ?
Forum Updated to NodeBB v4.3 + New Features

QDebug() Thread Safe ?

Scheduled Pinned Locked Moved General and Desktop
4 Posts 4 Posters 4.9k Views 2 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.
  • L Offline
    L Offline
    LarsG
    wrote on last edited by
    #1

    While debugging a deadlock problem I came to wonder if qDebug is thread safe, can it really be true it isn't ?

    The documentation does not explicit mention if it is thread safe or not.

    J 1 Reply Last reply
    0
    • M Offline
      M Offline
      miroslav
      wrote on last edited by
      #2

      Rule of thumb: If the documentation does not state that something is thread safe, it is not. But I wonder how qDebug() can be involved in a deadlock problem, since it should be reentrant.

      Mirko Boehm | mirko@kde.org | KDE e.V.
      FSFE Fellow
      Qt Certified Specialist

      1 Reply Last reply
      1
      • L LarsG

        While debugging a deadlock problem I came to wonder if qDebug is thread safe, can it really be true it isn't ?

        The documentation does not explicit mention if it is thread safe or not.

        J Offline
        J Offline
        James Mark Chan
        wrote on last edited by
        #3

        I know this is old but as of 2021/Qt 5 the documentation indicates it is thread safe:
        https://doc.qt.io/qt-5/qtglobal.html#qDebug

        JKSHJ 1 Reply Last reply
        0
        • J James Mark Chan

          I know this is old but as of 2021/Qt 5 the documentation indicates it is thread safe:
          https://doc.qt.io/qt-5/qtglobal.html#qDebug

          JKSHJ Offline
          JKSHJ Offline
          JKSH
          Moderators
          wrote on last edited by JKSH
          #4

          @James-Mark-Chan said in QDebug() Thread Safe ?:

          I know this is old but as of 2021/Qt 5 the documentation indicates it is thread safe:
          https://doc.qt.io/qt-5/qtglobal.html#qDebug

          qDebug() is thread-safe. That means your program won't get corrupted or crash if you use qDebug() in multiple threads.

          However, qDebug() sends data to stderr which is unbuffered. That means if stderr receives data from multiple threads, it might display the data in a way that looks jumbled.

          Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

          1 Reply Last reply
          4

          • Login

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