diff options
author | Marcus Brinkmann <marcus@gnu.org> | 2004-11-01 17:04:00 +0000 |
---|---|---|
committer | Thomas Schwinge <tschwinge@gnu.org> | 2009-04-06 22:39:57 +0200 |
commit | 7c600777057893b7e48b10963dca2444f25f9217 (patch) | |
tree | d9cafceb9ce2547dd4cf21b9414f0fc0aded297c /pthread | |
parent | 19981a7f1fbe8ef0fcc7a018d467060c7acaaa1b (diff) |
2004-11-01 Marcus Brinkmann <marcus@gnu.org>
* pthread/pt-internal.h: Include <atomic.h>, not <bits/atomic.h>.
(__pthread_total): Change type of declaration to uatomic_max_t.
* pthread/pt-alloc.c: Include <atomic.h>, not <bits/atomic.h>.
(__pthread_free_threads): Change type to uatomicptr_t.
(__pthread_alloc): Call atomic_compare_and_exchange_val_acq
instead of __atomicptr_compare_and_swap.
* pthread/pt-create.c: Include <atomic.h>, not <bits/atomic.h>.
(__pthread_total): Change type to uatomic_max_t.
(__pthread_create_internal): Call atomic_increment, not
__atomic_inc and atomic_decrement, not __atomic_dec.
* pthread/pt-dealloc.c: Include <atomic.h>, not <bits/atomic.h>.
(__pthread_free_threads): Declare as uatomicptr_t.
(__pthread_dealloc): Call atomic_compare_and_exchange_val_acq
instead of __atomicptr_compare_and_swap.
* pthread/pt-exit.c: Include <atomic.h>, not <bits/atomic.h>.
(pthread_exit): Call atomic_decrement_and_test instead of
__atomic_dec_and_test.
* sysdeps/l4/pt-create-np.c: Do not include <bits/atomic.h>.
Diffstat (limited to 'pthread')
-rw-r--r-- | pthread/pt-alloc.c | 12 | ||||
-rw-r--r-- | pthread/pt-create.c | 10 | ||||
-rw-r--r-- | pthread/pt-dealloc.c | 8 | ||||
-rw-r--r-- | pthread/pt-exit.c | 6 | ||||
-rw-r--r-- | pthread/pt-internal.h | 6 |
5 files changed, 21 insertions, 21 deletions
diff --git a/pthread/pt-alloc.c b/pthread/pt-alloc.c index 7c15fe15..dd9760d6 100644 --- a/pthread/pt-alloc.c +++ b/pthread/pt-alloc.c @@ -25,7 +25,7 @@ #include <pt-internal.h> -#include <bits/atomic.h> +#include <atomic.h> /* This braindamage is necessary because the standard says that some of the threads functions "shall fail" if "No thread could be found @@ -46,7 +46,7 @@ pthread_rwlock_t __pthread_threads_lock; /* List of thread structures corresponding to free thread IDs. */ -__atomicptr_t __pthread_free_threads; +uatomicptr_t __pthread_free_threads; static inline error_t initialize_pthread (struct __pthread *new, int recycling) @@ -97,8 +97,8 @@ __pthread_alloc (struct __pthread **pthread) /* Try to re-use a thread structure before creating a new one. */ while ((new = (struct __pthread *)__pthread_free_threads)) { - if (__atomicptr_compare_and_swap (&__pthread_free_threads, - new, new->next)) + if (atomic_compare_and_exchange_val_acq (&__pthread_free_threads, + new, new->next)) { /* Yes, we managed to get one. The thread number in the thread structure still refers to the correct slot. */ @@ -110,8 +110,8 @@ __pthread_alloc (struct __pthread **pthread) while (1) { new->next = (struct __pthread *)__pthread_free_threads; - if (__atomicptr_compare_and_swap (&__pthread_free_threads, - new->next, new)) + if (atomic_compare_and_exchange_val_acq + (&__pthread_free_threads, new->next, new)) break; } diff --git a/pthread/pt-create.c b/pthread/pt-create.c index 727fbac1..95df677e 100644 --- a/pthread/pt-create.c +++ b/pthread/pt-create.c @@ -1,5 +1,5 @@ /* Thread creation. - Copyright (C) 2000, 2002 Free Software Foundation, Inc. + Copyright (C) 2000, 2002, 2004 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 @@ -22,7 +22,7 @@ #include <pthread.h> #include <signal.h> -#include <bits/atomic.h> +#include <atomic.h> #include <pt-internal.h> @@ -33,7 +33,7 @@ /* The total number of pthreads currently active. This is defined here since it would be really stupid to have a threads-using program that doesn't call `pthread_create'. */ -__atomic_t __pthread_total; +uatomic_max_t __pthread_total; /* The entry-point for new threads. */ @@ -173,7 +173,7 @@ __pthread_create_internal (struct __pthread **thread, the number of threads from within the new thread isn't an option since this thread might return and call `pthread_exit' before the new thread runs. */ - __atomic_inc (&__pthread_total); + atomic_increment (&__pthread_total); /* Store a pointer to this thread in the thread ID lookup table. We could use __thread_setid, however, we only lock for reading as no @@ -200,7 +200,7 @@ __pthread_create_internal (struct __pthread **thread, failed_starting: __pthread_setid (pthread->thread, NULL); - __atomic_dec (&__pthread_total); + atomic_decrement (&__pthread_total); failed_sigstate: __pthread_sigstate_destroy (pthread); failed_setup: diff --git a/pthread/pt-dealloc.c b/pthread/pt-dealloc.c index 1fc7a7b3..f89f3545 100644 --- a/pthread/pt-dealloc.c +++ b/pthread/pt-dealloc.c @@ -23,10 +23,10 @@ #include <pt-internal.h> -#include <bits/atomic.h> +#include <atomic.h> /* List of thread structures corresponding to free thread IDs. */ -extern __atomicptr_t __pthread_free_threads; +extern uatomicptr_t __pthread_free_threads; /* Deallocate the thread structure for PTHREAD and the resources associated with it. */ @@ -54,8 +54,8 @@ __pthread_dealloc (struct __pthread *pthread) while (1) { pthread->next = (struct __pthread *)__pthread_free_threads; - if (__atomicptr_compare_and_swap (&__pthread_free_threads, - pthread->next, pthread)) + if (atomic_compare_and_exchange_val_acq (&__pthread_free_threads, + pthread->next, pthread)) return; } diff --git a/pthread/pt-exit.c b/pthread/pt-exit.c index fb9e97c0..68f596dc 100644 --- a/pthread/pt-exit.c +++ b/pthread/pt-exit.c @@ -1,5 +1,5 @@ /* Thread termination. - Copyright (C) 2000,02 Free Software Foundation, Inc. + Copyright (C) 2000, 2002, 2004 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 @@ -24,7 +24,7 @@ #include <pt-internal.h> -#include <bits/atomic.h> +#include <atomic.h> /* Terminate the current thread and make STATUS available to any @@ -56,7 +56,7 @@ pthread_exit (void *status) /* Decrease the number of threads. We use an atomic operation to make sure that only the last thread calls `exit'. */ - if (__atomic_dec_and_test (&__pthread_total)) + if (atomic_decrement_and_test (&__pthread_total)) /* We are the last thread. */ exit (0); diff --git a/pthread/pt-internal.h b/pthread/pt-internal.h index 79ce19c7..af3dd875 100644 --- a/pthread/pt-internal.h +++ b/pthread/pt-internal.h @@ -1,5 +1,5 @@ /* Internal defenitions for pthreads library. - Copyright (C) 2000 Free Software Foundation, Inc. + Copyright (C) 2000, 2004 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 @@ -27,7 +27,7 @@ #include <signal.h> #include <assert.h> #endif -#include <bits/atomic.h> +#include <atomic.h> #include <pt-key.h> @@ -126,7 +126,7 @@ __pthread_dequeue (struct __pthread *thread) element = element->next) /* The total number of threads currently active. */ -extern __atomic_t __pthread_total; +extern uatomic_max_t __pthread_total; /* The total number of thread IDs currently in use, or on the list of available thread IDs. */ |