glibc defines all of the pthread_* functions weakly within glibc itself so a program that uses them but does not link with libpthreads will still function. The functions are weakly defined to return a "no error" code. Unfortunately, for some reason pthread_mutex_trylock was left out. For example, this code works fine whether you link to libpthread or not: #include <pthread.h> int main(int argc,char *argv[]) { pthread_mutex_t mymutex=PTHREAD_MUTEX_INITIALIZER; pthread_mutex_lock(&mymutex); } On the other hand, this does not work (but should): #include <pthread.h> int main(int argc,char *argv[]) { pthread_mutex_t mymutex=PTHREAD_MUTEX_INITIALIZER; pthread_mutex_trylock(&mymutex); }
Still the same in 8.0 if this is actually a bug its still there Alan the bugzilla womble
If pthread_mutex_trylock isn't used, why should it have been defined? The definitions are not meant for programmers to rely on. RHL9 changed all that code, calling thread functions from libc works completely different now, even in the LinuxThreads code. I close the bug.