2003-02-15 Ulrich Drepper <drepper@redhat.com>
+ * pthreadP.h: Mark declarations of __find_in_stack_list, __free_tcb,
+ and __deallocate_stack with internal_function.
+ * pthread_create.c: Adjust definitions appropriately.
+ * allocatestack.c: Likewise.
+
+ * pthread_join.c: Add one more __builtin_expect.
+ * pthread_timedjoin.c: Likewise.
+
+ * pthread_getspecific.c (__pthread_getspecific): Clear data->data
+ not data of sequence number does not match.
+ Add one __builtin_expect.
+
* Makefile (tests): Add tst-clock1.
* tst-clock1.c: New file.
void
+internal_function
__deallocate_stack (struct pthread *pd)
{
lll_lock (stack_cache_lock);
/* Thread list handling. */
extern struct pthread *__find_in_stack_list (struct pthread *pd)
- attribute_hidden;
+ attribute_hidden internal_function;
/* Deallocate a thread's stack after optionally making sure the thread
descriptor is still valid. */
-extern void __free_tcb (struct pthread *pd) attribute_hidden;
+extern void __free_tcb (struct pthread *pd) attribute_hidden internal_function;
/* Free allocated stack. */
-extern void __deallocate_stack (struct pthread *pd) attribute_hidden;
+extern void __deallocate_stack (struct pthread *pd)
+ attribute_hidden internal_function;
/* Mark all the stacks except for the current one as available. This
function also re-initializes the lock for the stack cache. */
const int __pthread_pthread_sizeof_descr = sizeof (struct pthread);
struct pthread *
+internal_function
__find_in_stack_list (pd)
struct pthread *pd;
{
/* Deallocate a thread's stack after optionally making sure the thread
descriptor is still valid. */
void
+internal_function
__free_tcb (struct pthread *pd)
{
/* The thread is exiting now. */
{
uintptr_t seq = data->seq;
- if (seq != __pthread_keys[key].seq)
- result = data = NULL;
+ if (__builtin_expect (seq != __pthread_keys[key].seq, 0))
+ result = data->data = NULL;
}
return result;
/* Wait for the thread to finish. If it is already locked something
is wrong. There can only be one waiter. */
- if (atomic_compare_and_exchange_acq (&pd->joinid, self, NULL) != 0)
+ if (__builtin_expect (atomic_compare_and_exchange_acq (&pd->joinid, self,
+ NULL) != 0, 0))
/* There is already somebody waiting for the thread. */
return EINVAL;
-/* Copyright (C) 2002 Free Software Foundation, Inc.
+/* Copyright (C) 2002, 2003 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
/* Wait for the thread to finish. If it is already locked something
is wrong. There can only be one waiter. */
- if (atomic_compare_and_exchange_acq (&pd->joinid, self, NULL) != 0)
+ if (__builtin_expect (atomic_compare_and_exchange_acq (&pd->joinid, self,
+ NULL) != 0, 0))
/* There is already somebody waiting for the thread. */
return EINVAL;