Important: Please read the Qt Code of Conduct -

Linux threads compiler flags?

  • 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:

    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:


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


  • Qt Champions 2017

    Try this ?

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

    qDebug() << "Threading priority = "<< _POSIX_THREAD_PRIORITY_SCHEDULING << endl;

    return a.exec(&#41;;


  • 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?

  • Qt Champions 2017

    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.

  • 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.

  • 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.

  • Lifetime Qt Champion


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

  • [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.,, and [insert favorite Linux distro] to name a few. Build details for each are best sought from the source.

  • 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.

Log in to reply