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. Linux threads compiler flags?
QtWS25 Last Chance

Linux threads compiler flags?

Scheduled Pinned Locked Moved General and Desktop
9 Posts 4 Posters 2.8k Views
  • 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.
  • M Offline
    M Offline
    medvedm
    wrote on last edited by
    #1

    Hi all!

    I have the need to manipulate thread priorities in Linux, and after seeing the link in the QThread priority() documentation, I did some digging. The code I want exists in QThread, here:

    https://qt.gitorious.org/qt/qt/source/0aca5cf05288dc4d2175d1c4a78bf62a5ea96b21:src/corelib/thread/qthread_unix.cpp#L355

    But what I need to know are what flags were used when I downloaded the binaries and installed them, because of this #define line which basically decides whether linux priorities work or not:

    @
    #if defined(Q_OS_DARWIN) || !defined(Q_OS_OPENBSD) && defined(_POSIX_THREAD_PRIORITY_SCHEDULING) && (_POSIX_THREAD_PRIORITY_SCHEDULING-0 >= 0)
    @

    I need to know how this code was compiled to know if I've got this stuff or not. Not interested in recompiling.

    M

    1 Reply Last reply
    0
    • dheerendraD Offline
      dheerendraD Offline
      dheerendra
      Qt Champions 2022
      wrote on last edited by
      #2

      Try this ?

      @int main(int argc, char *argv[])
      {
      QApplication a(argc, argv);

      #ifdef _POSIX_THREAD_PRIORITY_SCHEDULING
      qDebug() << "Threading priority = "<< _POSIX_THREAD_PRIORITY_SCHEDULING << endl;
      #endif

      return a.exec(&#41;;
      

      }
      @

      Dheerendra
      @Community Service
      Certified Qt Specialist
      http://www.pthinks.com

      1 Reply Last reply
      0
      • M Offline
        M Offline
        medvedm
        wrote on last edited by
        #3

        I don't think it matters what if the symbol is defined on my system - I think what matters is if the symbol was defined when "they" compiled the library, right?

        1 Reply Last reply
        0
        • dheerendraD Offline
          dheerendraD Offline
          dheerendra
          Qt Champions 2022
          wrote on last edited by
          #4

          Yes. That is true. I checked with simple program. I have not defined anything like this when I compile the program. I'm getting this defined and value is -1.

          Dheerendra
          @Community Service
          Certified Qt Specialist
          http://www.pthinks.com

          1 Reply Last reply
          0
          • jeremy_kJ Offline
            jeremy_kJ Offline
            jeremy_k
            wrote on last edited by
            #5

            What is the goal of knowing the values of this particular set of flags?

            If it's about determining if QThread::setPriority() works, calling pthread_getschedparam() after to verify the requested change should work. Presumably digging in at this level of detail means having a little platform-specific investigation isn't a problem.

            Otherwise, you might get better answers with more information.

            Asking a question about code? http://eel.is/iso-c++/testcase/

            1 Reply Last reply
            0
            • M Offline
              M Offline
              medvedm
              wrote on last edited by
              #6

              I wouldn't think this would be a difficult question for the guys who put out the Qt binaries. Are these flags set for the Linux builds of Qt that they put up on the site or not?

              They appear to not be based on experiments I've done, and running chrt while the process is running to examine real time thread priority. None of the priority functions do anything on Linux.

              So if not, why not? The default is for inherit priority, which for people using the normal scheduler is just fine, and if you want to specify a priority, you should be able to, without having to rebuild the whole Qt system.

              Right now I've got a bunch of posix pthread code to do what I want (which is basically just the junk in the #defined section mentioned in the original post). Ugh... why deal with this when Qt has it already, just not by default.

              1 Reply Last reply
              0
              • SGaistS Offline
                SGaistS Offline
                SGaist
                Lifetime Qt Champion
                wrote on last edited by
                #7

                Hi,

                This is a community driven forum, the guys who put out the Qt binaries are reachable on the interest mailing list.

                Interested in AI ? www.idiap.ch
                Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                1 Reply Last reply
                0
                • jeremy_kJ Offline
                  jeremy_kJ Offline
                  jeremy_k
                  wrote on last edited by
                  #8

                  [quote author="medvedm" date="1408995762"]I wouldn't think this would be a difficult question for the guys who put out the Qt binaries.[/quote]

                  What guys? What binaries? I know of several places to download builds from. http://qt-project.org/downloads, http://qt.digia.com/Try-Buy/, and [insert favorite Linux distro] to name a few. Build details for each are best sought from the source.

                  Asking a question about code? http://eel.is/iso-c++/testcase/

                  1 Reply Last reply
                  0
                  • M Offline
                    M Offline
                    medvedm
                    wrote on last edited by
                    #9

                    http://qt-project.org/downloads is what I mean. I'll look for said mailing list. This is good to have on the forums, though, for people googling in the future.

                    1 Reply Last reply
                    0

                    • Login

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