Bug 11771 - pthread_mutex_trylock is not weakly defined in glibc-2.1.3-15
Summary: pthread_mutex_trylock is not weakly defined in glibc-2.1.3-15
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: glibc   
(Show other bugs)
Version: 8.0
Hardware: i386 Linux
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact:
Depends On:
TreeView+ depends on / blocked
Reported: 2000-05-31 04:05 UTC by David Shaw
Modified: 2016-11-24 15:09 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2003-04-22 00:14:14 UTC
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

Description David Shaw 2000-05-31 04:05:19 UTC
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;

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;


Comment 1 Alan Cox 2002-12-14 23:43:45 UTC
Still the same in 8.0 if this is actually a bug its still there

Alan the bugzilla womble

Comment 2 Ulrich Drepper 2003-04-22 00:14:14 UTC
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.

Note You need to log in before you can comment on or make changes to this bug.