* init.c (__pthread_initialize_minimal_internal): Optimize test

FUTEX_CLOCK_REALTIME a bit.
This commit is contained in:
Ulrich Drepper 2009-01-04 18:10:04 +00:00
parent a9fa090b02
commit 3c612057ae
2 changed files with 25 additions and 16 deletions

View File

@ -1,3 +1,8 @@
2009-01-04 Ulrich Drepper <drepper@redhat.com>
* init.c (__pthread_initialize_minimal_internal): Optimize test
FUTEX_CLOCK_REALTIME a bit.
2009-01-03 Ulrich Drepper <drepper@redhat.com>
* init.c (__pthread_initialize_minimal_internal): Cheat a bit by

View File

@ -300,8 +300,13 @@ __pthread_initialize_minimal_internal (void)
if (!INTERNAL_SYSCALL_ERROR_P (word, err))
THREAD_SETMEM (pd, header.private_futex, FUTEX_PRIVATE_FLAG);
}
#endif
/* Private futexes have been introduced earlier than the
FUTEX_CLOCK_REALTIME flag. We don't have to run the test if we
know the former are not supported. This also means we know the
kernel will return ENOSYS for unknown operations. */
if (THREAD_GETMEM (pd, header.private_futex) != 0)
#endif
#ifndef __ASSUME_FUTEX_CLOCK_REALTIME
{
int word = 0;
@ -313,9 +318,8 @@ __pthread_initialize_minimal_internal (void)
word = INTERNAL_SYSCALL (futex, err, 5, &word,
FUTEX_WAIT_BITSET | FUTEX_CLOCK_REALTIME
| FUTEX_PRIVATE_FLAG, 1, NULL, 0);
if (!INTERNAL_SYSCALL_ERROR_P (word, err)
|| (INTERNAL_SYSCALL_ERRNO (word, err) != ENOSYS
&& INTERNAL_SYSCALL_ERRNO (word, err) != EINVAL))
assert (INTERNAL_SYSCALL_ERROR_P (word, err));
if (INTERNAL_SYSCALL_ERRNO (word, err) != ENOSYS)
__set_futex_clock_realtime ();
}
#endif