mirror of git://sourceware.org/git/glibc.git
* pthread_rwlock_trywrlock.c (__pthread_rwlock_trywrlock): Respect
reader preference. * sysdeps/pthread/pthread_rwlock_timedwrlock.c (pthread_rwlock_timedwrlock): Likewise. * sysdeps/pthread/pthread_rwlock_wrlock.c (__pthread_rwlock_wrlock): Likewise.
This commit is contained in:
parent
99ea5991a4
commit
bee2df0bb9
|
@ -1,3 +1,12 @@
|
||||||
|
2006-08-30 Ulrich Drepper <drepper@redhat.com>
|
||||||
|
|
||||||
|
* pthread_rwlock_trywrlock.c (__pthread_rwlock_trywrlock): Respect
|
||||||
|
reader preference.
|
||||||
|
* sysdeps/pthread/pthread_rwlock_timedwrlock.c
|
||||||
|
(pthread_rwlock_timedwrlock): Likewise.
|
||||||
|
* sysdeps/pthread/pthread_rwlock_wrlock.c (__pthread_rwlock_wrlock):
|
||||||
|
Likewise.
|
||||||
|
|
||||||
2006-08-25 Jakub Jelinek <jakub@redhat.com>
|
2006-08-25 Jakub Jelinek <jakub@redhat.com>
|
||||||
|
|
||||||
* sysdeps/unix/sysv/linux/libc_pthread_init.c (freeres_libpthread):
|
* sysdeps/unix/sysv/linux/libc_pthread_init.c (freeres_libpthread):
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright (C) 2002, 2003 Free Software Foundation, Inc.
|
/* Copyright (C) 2002, 2003, 2006 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
|
Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
|
||||||
|
|
||||||
|
@ -30,7 +30,10 @@ __pthread_rwlock_trywrlock (rwlock)
|
||||||
|
|
||||||
lll_mutex_lock (rwlock->__data.__lock);
|
lll_mutex_lock (rwlock->__data.__lock);
|
||||||
|
|
||||||
if (rwlock->__data.__writer == 0 && rwlock->__data.__nr_readers == 0)
|
if (rwlock->__data.__writer == 0 && rwlock->__data.__nr_readers == 0
|
||||||
|
/* Respect the preference. */
|
||||||
|
&& (rwlock->__data.__flags != 0
|
||||||
|
|| rwlock->__data.__nr_readers_queued == 0))
|
||||||
{
|
{
|
||||||
rwlock->__data.__writer = THREAD_GETMEM (THREAD_SELF, tid);
|
rwlock->__data.__writer = THREAD_GETMEM (THREAD_SELF, tid);
|
||||||
result = 0;
|
result = 0;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright (C) 2003, 2004 Free Software Foundation, Inc.
|
/* Copyright (C) 2003, 2004, 2006 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
Contributed by Martin Schwidefsky <schwidefsky@de.ibm.com>, 2003.
|
Contributed by Martin Schwidefsky <schwidefsky@de.ibm.com>, 2003.
|
||||||
|
|
||||||
|
@ -40,7 +40,9 @@ pthread_rwlock_timedwrlock (rwlock, abstime)
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
/* Get the rwlock if there is no writer and no reader. */
|
/* Get the rwlock if there is no writer and no reader. */
|
||||||
if (rwlock->__data.__writer == 0 && rwlock->__data.__nr_readers == 0)
|
if (rwlock->__data.__writer == 0 && rwlock->__data.__nr_readers == 0
|
||||||
|
&& (rwlock->__data.__flags != 0
|
||||||
|
|| rwlock->__data.__nr_readers_queued == 0))
|
||||||
{
|
{
|
||||||
/* Mark self as writer. */
|
/* Mark self as writer. */
|
||||||
rwlock->__data.__writer = THREAD_GETMEM (THREAD_SELF, tid);
|
rwlock->__data.__writer = THREAD_GETMEM (THREAD_SELF, tid);
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright (C) 2003 Free Software Foundation, Inc.
|
/* Copyright (C) 2003, 2006 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
Contributed by Martin Schwidefsky <schwidefsky@de.ibm.com>, 2003.
|
Contributed by Martin Schwidefsky <schwidefsky@de.ibm.com>, 2003.
|
||||||
|
|
||||||
|
@ -37,7 +37,9 @@ __pthread_rwlock_wrlock (rwlock)
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
/* Get the rwlock if there is no writer and no reader. */
|
/* Get the rwlock if there is no writer and no reader. */
|
||||||
if (rwlock->__data.__writer == 0 && rwlock->__data.__nr_readers == 0)
|
if (rwlock->__data.__writer == 0 && rwlock->__data.__nr_readers == 0
|
||||||
|
&& (rwlock->__data.__flags != 0
|
||||||
|
|| rwlock->__data.__nr_readers_queued == 0))
|
||||||
{
|
{
|
||||||
/* Mark self as writer. */
|
/* Mark self as writer. */
|
||||||
rwlock->__data.__writer = THREAD_GETMEM (THREAD_SELF, tid);
|
rwlock->__data.__writer = THREAD_GETMEM (THREAD_SELF, tid);
|
||||||
|
|
Loading…
Reference in New Issue