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:

    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



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

    }
    @



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



  • 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

    Hi,

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



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


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.