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
(__pthread_cond_timedwait): Get internal lock in case timeout has
passed before the futex syscall.
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>
-/* Copyright (C) 2003 Free Software Foundation, Inc.
+/* Copyright (C) 2003, 2004 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Martin Schwidefsky <schwidefsky@de.ibm.com>, 2003.
while (1)
{
+ /* Prepare to wait. Release the condvar futex. */
+ lll_mutex_unlock (cond->__data.__lock);
+
struct timespec rt;
{
#ifdef __NR_clock_gettime
--rt.tv_sec;
}
/* Did we already time out? */
- if (rt.tv_sec < 0)
+ if (__builtin_expect (rt.tv_sec < 0, 0))
{
- /* Yep. Adjust the sequence counter. */
- ++cond->__data.__wakeup_seq;
+ /* We are going to look at shared data again, so get the lock. */
+ lll_mutex_lock(cond->__data.__lock);
- /* The error value. */
- result = ETIMEDOUT;
- break;
+ goto timeout;
}
- /* Prepare to wait. Release the condvar futex. */
- lll_mutex_unlock (cond->__data.__lock);
-
/* Enable asynchronous cancellation. Required by the standard. */
cbuffer.oldtype = __pthread_enable_asynccancel ();
break;
/* Not woken yet. Maybe the time expired? */
- if (err == -ETIMEDOUT)
+ if (__builtin_expect (err == -ETIMEDOUT, 0))
{
+ timeout:
/* Yep. Adjust the counters. */
++cond->__data.__wakeup_seq;