diff options
author | Neal H. Walfield <neal@gnu.org> | 2008-06-01 20:25:36 +0000 |
---|---|---|
committer | Thomas Schwinge <tschwinge@gnu.org> | 2009-04-07 23:16:53 +0200 |
commit | 4a4fd9acc62e401c034717d0b5772c96291d24a2 (patch) | |
tree | 54dde3f5dc7405a69e1f7c5943e92ea0ee59a185 /sysdeps/generic/pt-mutex-init.c | |
parent | 61f38c39b247dd0e9fe980690db56c34ca1384ec (diff) |
2008-06-01 Neal H. Walfield <neal@gnu.org>
* include/pthread/pthread.h (PTHREAD_MUTEX_RECURSIVE_INITIALIZER_NP):
New definition.
* sysdeps/generic/bits/mutex.h
(__PTHREAD_MUTEX_RECURSIVE_INITIALIZER): New definition.
* sysdeps/generic/bits/mutex-attr.h (__pthread_recursive_mutexattr):
New definition.
* sysdeps/generic/pt-mutexattr.c (__pthread_recursive_mutexattr):
New declaration.
* sysdeps/generic/pt-mutex-init.c (_pthread_mutex_init): If ATTR
is &__PTHREAD_RECURSIVE_MUTEXATTR, don't allocate a copy, just
save in MUTEX->ATTR.
* sysdeps/generic/pt-mutex-destroy.c (_pthread_mutex_destroy): If
MUTEX->ATTR is &__PTHREAD_RECURSIVE_MUTEXATTR, don't free it.
Diffstat (limited to 'sysdeps/generic/pt-mutex-init.c')
-rw-r--r-- | sysdeps/generic/pt-mutex-init.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/sysdeps/generic/pt-mutex-init.c b/sysdeps/generic/pt-mutex-init.c index da1781bf..83f5b185 100644 --- a/sysdeps/generic/pt-mutex-init.c +++ b/sysdeps/generic/pt-mutex-init.c @@ -1,5 +1,5 @@ /* Initialize a mutex. Generic version. - Copyright (C) 2000, 2002, 2005 Free Software Foundation, Inc. + Copyright (C) 2000, 2002, 2005, 2008 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -32,10 +32,15 @@ _pthread_mutex_init (pthread_mutex_t *mutex, if (! attr || memcmp (attr, &__pthread_default_mutexattr, sizeof (*attr) == 0)) - /* Use the default attributes. */ + /* The default attributes. */ return 0; - /* Non-default attributes. */ + if (attr == &__pthread_recursive_mutexattr) + /* Non-default but known attributes. */ + { + mutex->attr = attr; + return 0; + } mutex->attr = malloc (sizeof *attr); if (! mutex->attr) |