summaryrefslogtreecommitdiff
path: root/sysdeps/generic/bits/mutex.h
diff options
context:
space:
mode:
authorNeal H. Walfield <neal@gnu.org>2007-11-20 16:23:24 +0000
committerThomas Schwinge <tschwinge@gnu.org>2009-04-07 23:05:35 +0200
commite16179334211cd7e2877197140b06b83e2f03733 (patch)
tree25ffab176418a96477e2e95cfc5540f839bfec22 /sysdeps/generic/bits/mutex.h
parent426e7e7edf67380ec5afc9791a9541b0f8e2c452 (diff)
parent0697fd051821d7b44b3c9ab2face57438e1a764a (diff)
2007-11-20 Neal H. Walfield <neal@gnu.org>
Merge changes from mainline Hurd. Update L4 bits to compile with those changes. * sysdeps/l4/pt-block.c (__pthread_block): Call l4_receive, not L4_Receive. * sysdeps/l4/pt-create-np.c (pthread_create_from_l4_tid_np): Don't pass TID to __pthread_create_internal. Emit a warning. * sysdeps/l4/pt-stack-alloc.c (allocate_page): Remove function. (__pthread_stack_alloc): Don't require that STACKSIZE is equal to __pthread_stacksize. Call mmap. * sysdeps/l4/pt-thread-halt.c (__pthread_thread_halt): Take additional argument, need_dealloc. Call __pthread_dealloc. Stop the thread. * sysdeps/l4/hurd/pt-sysdep.c (init_routine): When calling __pthread_create_internal, don't pass the tid. * tests/test-1.c (main): Use pthread_mutex_init, not PTHREAD_MUTEX_INITIALIZER. * pthread/pt-alloc.c: Don't include <bits/atomic.h>. Include <atomic.h>. (__pthread_free_threads): Make it an atomicptr_t, not an __atomicptr_t. (__pthread_alloc): Don't use __atomicptr_compare_and_swap, use atomic_compare_and_exchange_val_acq. * pthread/pt-create.c: Don't include <bits/atomic.h>. Include <atomic.h>. (__pthread_total): Make it an atomic_fast32_t, not an __atomic_t. (__pthread_create_internal): Use atomic_increment and atomic_decrement, not __atomic_inc and __atomic_dec. * pthread/pt-dealloc.c: Don't include <bits/atomic.h>. Include <atomic.h>. (__pthread_free_threads): Make it an atomicptr_t, not an __atomicptr_t. (__pthread_dealloc): Use atomic_compare_and_exchange_val_acq, not __atomicptr_compare_and_swap. * pthread/pt-exit.c: Don't include <bits/atomic.h>. Include <atomic.h>. (pthread_exit): Use atomic_decrement_and_test, not __atomic_dec_and_test. * pthread/pt-internal.h: Don't include <bits/atomic.h>. Include <atomic.h>. (__pthread_total): Make it an atomic_fast32_t, not an __atomic_t. * sysdeps/powerpc/bits/atomic.h: Remove file. * sysdeps/ia32/bits/atomic.h: Likewise.
Diffstat (limited to 'sysdeps/generic/bits/mutex.h')
-rw-r--r--sysdeps/generic/bits/mutex.h75
1 files changed, 2 insertions, 73 deletions
diff --git a/sysdeps/generic/bits/mutex.h b/sysdeps/generic/bits/mutex.h
index ecbcff8..1aaf80e 100644
--- a/sysdeps/generic/bits/mutex.h
+++ b/sysdeps/generic/bits/mutex.h
@@ -1,5 +1,5 @@
/* Mutex type. Generic version.
- Copyright (C) 2000,02 Free Software Foundation, Inc.
+ Copyright (C) 2000, 2002, 2005 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -52,8 +52,7 @@ struct __pthread_mutex
/* Initializer for a mutex. N.B. this also happens to be compatible
with the cthread mutex initializer. */
# define __PTHREAD_MUTEX_INITIALIZER \
- { __SPIN_LOCK_INITIALIZER, __SPIN_LOCK_INITIALIZER, NULL, NULL, NULL, \
- NULL, 0, 0 }
+ { __SPIN_LOCK_INITIALIZER, __SPIN_LOCK_INITIALIZER, 0, 0, 0, 0, 0, 0 }
# endif
#endif /* Not __pthread_mutex_defined. */
@@ -63,76 +62,6 @@ struct __pthread_mutex
#include <errno.h>
#include <stddef.h>
-#ifdef __USE_EXTERN_INLINES
-
-# ifndef _EXTERN_INLINE
-# define _EXTERN_INLINE extern __inline
-# endif
-
-_EXTERN_INLINE int
-pthread_mutex_init (struct __pthread_mutex *__mutex,
- const pthread_mutexattr_t *attr)
-{
- extern int _pthread_mutex_init (struct __pthread_mutex *,
- const pthread_mutexattr_t *);
-
- if (attr)
- return _pthread_mutex_init (__mutex, attr);
-
- *__mutex = (struct __pthread_mutex) __PTHREAD_MUTEX_INITIALIZER;
- return 0;
-}
-
-_EXTERN_INLINE int
-pthread_mutex_destroy (struct __pthread_mutex *__mutex)
-{
- extern int _pthread_mutex_destroy (struct __pthread_mutex *);
-
- if (__mutex->attr || __mutex->data)
- return _pthread_mutex_destroy (__mutex);
-
- return 0;
-}
-
-_EXTERN_INLINE int
-__pthread_mutex_lock (struct __pthread_mutex *__mutex)
-{
- extern int _pthread_mutex_lock (struct __pthread_mutex *);
-
- if (__mutex->attr == NULL
- && __mutex->data == NULL
- && __pthread_spin_trylock (&__mutex->__held) == 0)
- return 0;
-
- return _pthread_mutex_lock (__mutex);
-}
-
-extern inline int
-__pthread_mutex_trylock (struct __pthread_mutex *__mutex)
-{
- extern int _pthread_mutex_trylock (struct __pthread_mutex *);
-
- if (__mutex->attr == NULL
- && __mutex->data == NULL)
- return __pthread_spin_trylock (&__mutex->__held);
-
- return _pthread_mutex_trylock (__mutex);
-}
-
-extern inline int
-pthread_mutex_lock (struct __pthread_mutex *__mutex)
-{
- return __pthread_mutex_lock (__mutex);
-}
-
-extern inline int
-pthread_mutex_trylock (struct __pthread_mutex *__mutex)
-{
- return __pthread_mutex_trylock (__mutex);
-}
-
-#endif /* Use extern inlines. */
-
#endif
#endif /* bits/mutex.h */