mirror of git://sourceware.org/git/glibc.git
Update.
* sysdeps/pthread/pthread_cond_timedwait.c (__pthread_cond_timedwait): Optimize. Drop internal lock earlier. Reuse code. Add __builtin_expects. * init.c (pthread_functions): Make array const.
This commit is contained in:
parent
3730d95c77
commit
219304ecbb
|
|
@ -1,5 +1,9 @@
|
||||||
2004-02-13 Ulrich Drepper <drepper@redhat.com>
|
2004-02-13 Ulrich Drepper <drepper@redhat.com>
|
||||||
|
|
||||||
|
* sysdeps/pthread/pthread_cond_timedwait.c
|
||||||
|
(__pthread_cond_timedwait): Optimize. Drop internal lock earlier.
|
||||||
|
Reuse code. Add __builtin_expects.
|
||||||
|
|
||||||
* sysdeps/unix/sysv/linux/i386/i486/pthread_cond_timedwait.S
|
* sysdeps/unix/sysv/linux/i386/i486/pthread_cond_timedwait.S
|
||||||
(__pthread_cond_timedwait): Get internal lock in case timeout has
|
(__pthread_cond_timedwait): Get internal lock in case timeout has
|
||||||
passed before the futex syscall.
|
passed before the futex syscall.
|
||||||
|
|
@ -35,7 +39,7 @@
|
||||||
|
|
||||||
2004-01-14 Ulrich Drepper <drepper@redhat.com>
|
2004-01-14 Ulrich Drepper <drepper@redhat.com>
|
||||||
|
|
||||||
* init.c (pthread_funtions): Make array const.
|
* init.c (pthread_functions): Make array const.
|
||||||
|
|
||||||
2004-01-13 Ulrich Drepper <drepper@redhat.com>
|
2004-01-13 Ulrich Drepper <drepper@redhat.com>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright (C) 2003 Free Software Foundation, Inc.
|
/* Copyright (C) 2003, 2004 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.
|
||||||
|
|
||||||
|
|
@ -98,6 +98,9 @@ __pthread_cond_timedwait (cond, mutex, abstime)
|
||||||
|
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
|
/* Prepare to wait. Release the condvar futex. */
|
||||||
|
lll_mutex_unlock (cond->__data.__lock);
|
||||||
|
|
||||||
struct timespec rt;
|
struct timespec rt;
|
||||||
{
|
{
|
||||||
#ifdef __NR_clock_gettime
|
#ifdef __NR_clock_gettime
|
||||||
|
|
@ -138,19 +141,14 @@ __pthread_cond_timedwait (cond, mutex, abstime)
|
||||||
--rt.tv_sec;
|
--rt.tv_sec;
|
||||||
}
|
}
|
||||||
/* Did we already time out? */
|
/* Did we already time out? */
|
||||||
if (rt.tv_sec < 0)
|
if (__builtin_expect (rt.tv_sec < 0, 0))
|
||||||
{
|
{
|
||||||
/* Yep. Adjust the sequence counter. */
|
/* We are going to look at shared data again, so get the lock. */
|
||||||
++cond->__data.__wakeup_seq;
|
lll_mutex_lock(cond->__data.__lock);
|
||||||
|
|
||||||
/* The error value. */
|
goto timeout;
|
||||||
result = ETIMEDOUT;
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Prepare to wait. Release the condvar futex. */
|
|
||||||
lll_mutex_unlock (cond->__data.__lock);
|
|
||||||
|
|
||||||
/* Enable asynchronous cancellation. Required by the standard. */
|
/* Enable asynchronous cancellation. Required by the standard. */
|
||||||
cbuffer.oldtype = __pthread_enable_asynccancel ();
|
cbuffer.oldtype = __pthread_enable_asynccancel ();
|
||||||
|
|
||||||
|
|
@ -170,8 +168,9 @@ __pthread_cond_timedwait (cond, mutex, abstime)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* Not woken yet. Maybe the time expired? */
|
/* Not woken yet. Maybe the time expired? */
|
||||||
if (err == -ETIMEDOUT)
|
if (__builtin_expect (err == -ETIMEDOUT, 0))
|
||||||
{
|
{
|
||||||
|
timeout:
|
||||||
/* Yep. Adjust the counters. */
|
/* Yep. Adjust the counters. */
|
||||||
++cond->__data.__wakeup_seq;
|
++cond->__data.__wakeup_seq;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue