mirror of
git://sourceware.org/git/glibc.git
synced 2024-11-27 03:41:23 +08:00
* pthreadP.h (PTHREAD_RWLOCK_PREFER_READER_P): Define.
* pthread_rwlock_rdlock.c: Use PTHREAD_RWLOCK_PREFER_READER_P. * pthread_rwlock_timedrdlock.c: Likewise. * pthread_rwlock_tryrdlock.c: Likewise.
This commit is contained in:
parent
a2dd3360db
commit
546346b6f8
@ -1,5 +1,10 @@
|
|||||||
2007-05-26 Ulrich Drepper <drepper@redhat.com>
|
2007-05-26 Ulrich Drepper <drepper@redhat.com>
|
||||||
|
|
||||||
|
* pthreadP.h (PTHREAD_RWLOCK_PREFER_READER_P): Define.
|
||||||
|
* pthread_rwlock_rdlock.c: Use PTHREAD_RWLOCK_PREFER_READER_P.
|
||||||
|
* pthread_rwlock_timedrdlock.c: Likewise.
|
||||||
|
* pthread_rwlock_tryrdlock.c: Likewise.
|
||||||
|
|
||||||
* sysdeps/unix/sysv/linux/x86_64/sem_trywait.S (sem_trywait): Tiny
|
* sysdeps/unix/sysv/linux/x86_64/sem_trywait.S (sem_trywait): Tiny
|
||||||
optimization.
|
optimization.
|
||||||
|
|
||||||
|
@ -118,6 +118,11 @@ enum
|
|||||||
| PTHREAD_MUTEXATTR_PROTOCOL_MASK | PTHREAD_MUTEXATTR_PRIO_CEILING_MASK)
|
| PTHREAD_MUTEXATTR_PROTOCOL_MASK | PTHREAD_MUTEXATTR_PRIO_CEILING_MASK)
|
||||||
|
|
||||||
|
|
||||||
|
/* Check whether rwlock prefers readers. */
|
||||||
|
#define PTHREAD_RWLOCK_PREFER_READER_P(rwlock) \
|
||||||
|
((rwlock)->__data.__flags == 0)
|
||||||
|
|
||||||
|
|
||||||
/* Bits used in robust mutex implementation. */
|
/* Bits used in robust mutex implementation. */
|
||||||
#define FUTEX_WAITERS 0x80000000
|
#define FUTEX_WAITERS 0x80000000
|
||||||
#define FUTEX_OWNER_DIED 0x40000000
|
#define FUTEX_OWNER_DIED 0x40000000
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* Copyright (C) 2003, 2004 Free Software Foundation, Inc.
|
/* Copyright (C) 2003, 2004, 2007 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,7 @@ __pthread_rwlock_rdlock (rwlock)
|
|||||||
if (rwlock->__data.__writer == 0
|
if (rwlock->__data.__writer == 0
|
||||||
/* ...and if either no writer is waiting or we prefer readers. */
|
/* ...and if either no writer is waiting or we prefer readers. */
|
||||||
&& (!rwlock->__data.__nr_writers_queued
|
&& (!rwlock->__data.__nr_writers_queued
|
||||||
|| rwlock->__data.__flags == 0))
|
|| PTHREAD_RWLOCK_PREFER_READER_P (rwlock)))
|
||||||
{
|
{
|
||||||
/* Increment the reader counter. Avoid overflow. */
|
/* Increment the reader counter. Avoid overflow. */
|
||||||
if (__builtin_expect (++rwlock->__data.__nr_readers == 0, 0))
|
if (__builtin_expect (++rwlock->__data.__nr_readers == 0, 0))
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* Copyright (C) 2003, 2004 Free Software Foundation, Inc.
|
/* Copyright (C) 2003, 2004, 2007 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.
|
||||||
|
|
||||||
@ -43,7 +43,7 @@ pthread_rwlock_timedrdlock (rwlock, abstime)
|
|||||||
if (rwlock->__data.__writer == 0
|
if (rwlock->__data.__writer == 0
|
||||||
/* ...and if either no writer is waiting or we prefer readers. */
|
/* ...and if either no writer is waiting or we prefer readers. */
|
||||||
&& (!rwlock->__data.__nr_writers_queued
|
&& (!rwlock->__data.__nr_writers_queued
|
||||||
|| rwlock->__data.__flags == 0))
|
|| PTHREAD_RWLOCK_PREFER_READER_P (rwlock)))
|
||||||
{
|
{
|
||||||
/* Increment the reader counter. Avoid overflow. */
|
/* Increment the reader counter. Avoid overflow. */
|
||||||
if (++rwlock->__data.__nr_readers == 0)
|
if (++rwlock->__data.__nr_readers == 0)
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* Copyright (C) 2002 Free Software Foundation, Inc.
|
/* Copyright (C) 2002, 2007 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.
|
||||||
|
|
||||||
@ -32,7 +32,7 @@ __pthread_rwlock_tryrdlock (rwlock)
|
|||||||
|
|
||||||
if (rwlock->__data.__writer == 0
|
if (rwlock->__data.__writer == 0
|
||||||
&& (rwlock->__data.__nr_writers_queued == 0
|
&& (rwlock->__data.__nr_writers_queued == 0
|
||||||
|| rwlock->__data.__flags == 0))
|
|| PTHREAD_RWLOCK_PREFER_READER_P (rwlock)))
|
||||||
{
|
{
|
||||||
if (__builtin_expect (++rwlock->__data.__nr_readers == 0, 0))
|
if (__builtin_expect (++rwlock->__data.__nr_readers == 0, 0))
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user