views:

231

answers:

1

I've written some pthread code that use timed waits on a condition variable but in order to ensure a relative wait I've set the condvar's clock type to CLOCK_MONOTONIC using pthread_condattr_setclock().

In order to compile and link pthread_condattr_setclock() on RHEL4, i've had to add -I/usr/include/nptl and -L/usr/lib/nptl to my gcc command line. My understanding is that the 2.6 kernel (which RHEL4 has) uses the NPTL pthread implementation by default so why do I need to specify these paths explicitly to use this function?

It's only this function that requires me to do this: if I leave it out, everything compiles and links fine without the extra paths specified (although the behaviour of the code is then incorrect).

+1  A: 

From what I been able to find out, the pthread header and library in /usr/include and /usr/lib respectively are the old LinuxThreads implementations and my supposition is that they are there for backwards compatability (i.e. you should build against the old interface) but at run time the NPTL implementation is used (which has an interface that is a superset of the LinuxThreads interface).

Therefore, you can only use the new NPTL interface (i.e. if you require some extra functionality) if you know that you need it and, crucially, you know that the NPTL interface will be available at runtime.

TheJuice