summaryrefslogtreecommitdiff
path: root/src/atomic_ops.c
diff options
context:
space:
mode:
authorivmai <ivmai>2009-09-16 10:47:31 +0000
committerIvan Maidanski <ivmai@mail.ru>2011-07-25 16:03:25 +0400
commit257c082cb6e2f3ad8408ffc8dfd4ad7758fea25f (patch)
treedf25660743cbab8632ebaa845b0a3359eec1b426 /src/atomic_ops.c
parent7b422ef2cc4378840d9674a18b608559c8b48e9d (diff)
downloadlibatomic_ops-257c082cb6e2f3ad8408ffc8dfd4ad7758fea25f.tar.gz
2009-09-16 Ivan Maidanski <ivmai@mail.ru>
* ChangeLog: Remove trailing spaces at EOLn. * doc/README.txt: Expand all tabs to spaces; remove trailing spaces at EOLn; remove multiple trailing blank lines. * src/atomic_ops.c: Ditto. * src/atomic_ops.h: Ditto. * src/atomic_ops/generalize-small.h: Ditto. * src/atomic_ops/generalize.h: Ditto. * src/atomic_ops/sysdeps/acquire_release_volatile.h: Ditto. * src/atomic_ops/sysdeps/aligned_atomic_load_store.h: Ditto. * src/atomic_ops/sysdeps/all_aligned_atomic_load_store.h: Ditto. * src/atomic_ops/sysdeps/all_atomic_load_store.h: Ditto. * src/atomic_ops/sysdeps/ao_t_is_int.h: Ditto. * src/atomic_ops/sysdeps/armcc/arm_v6.h: Ditto. * src/atomic_ops/sysdeps/atomic_load_store.h: Ditto. * src/atomic_ops/sysdeps/char_acquire_release_volatile.h: Ditto. * src/atomic_ops/sysdeps/char_atomic_load_store.h: Ditto. * src/atomic_ops/sysdeps/gcc/alpha.h: Ditto. * src/atomic_ops/sysdeps/gcc/arm.h: Ditto. * src/atomic_ops/sysdeps/gcc/hppa.h: Ditto. * src/atomic_ops/sysdeps/gcc/ia64.h: Ditto. * src/atomic_ops/sysdeps/gcc/m68k.h: Ditto. * src/atomic_ops/sysdeps/gcc/mips.h: Ditto. * src/atomic_ops/sysdeps/gcc/powerpc.h: Ditto. * src/atomic_ops/sysdeps/gcc/s390.h: Ditto. * src/atomic_ops/sysdeps/gcc/sparc.h: Ditto. * src/atomic_ops/sysdeps/gcc/x86.h: Ditto. * src/atomic_ops/sysdeps/gcc/x86_64.h: Ditto. * src/atomic_ops/sysdeps/generic_pthread.h: Ditto. * src/atomic_ops/sysdeps/hpc/hppa.h: Ditto. * src/atomic_ops/sysdeps/hpc/ia64.h: Ditto. * src/atomic_ops/sysdeps/ibmc/powerpc.h: Ditto. * src/atomic_ops/sysdeps/icc/ia64.h: Ditto. * src/atomic_ops/sysdeps/int_acquire_release_volatile.h: Ditto. * src/atomic_ops/sysdeps/int_aligned_atomic_load_store.h: Ditto. * src/atomic_ops/sysdeps/int_atomic_load_store.h: Ditto. * src/atomic_ops/sysdeps/msftc/arm.h: Ditto. * src/atomic_ops/sysdeps/msftc/common32_defs.h: Ditto. * src/atomic_ops/sysdeps/msftc/x86.h: Ditto. * src/atomic_ops/sysdeps/msftc/x86_64.h: Ditto. * src/atomic_ops/sysdeps/ordered.h: Ditto. * src/atomic_ops/sysdeps/ordered_except_wr.h: Ditto. * src/atomic_ops/sysdeps/read_ordered.h: Ditto. * src/atomic_ops/sysdeps/short_acquire_release_volatile.h: Ditto. * src/atomic_ops/sysdeps/short_aligned_atomic_load_store.h: Ditto. * src/atomic_ops/sysdeps/short_atomic_load_store.h: Ditto. * src/atomic_ops/sysdeps/standard_ao_double_t.h: Ditto. * src/atomic_ops/sysdeps/sunc/x86.h: Ditto. * src/atomic_ops/sysdeps/sunc/x86_64.h: Ditto. * src/atomic_ops/sysdeps/test_and_set_t_is_ao_t.h: Ditto. * src/atomic_ops_stack.c: Ditto. * src/atomic_ops_stack.h: Ditto. * src/atomic_ops/sysdeps/gcc/arm.h: Replace non-ASCII quotes in a comment. * src/atomic_ops/sysdeps/gcc/mips.h: Use Unix-style EOLn.
Diffstat (limited to 'src/atomic_ops.c')
-rw-r--r--src/atomic_ops.c68
1 files changed, 34 insertions, 34 deletions
diff --git a/src/atomic_ops.c b/src/atomic_ops.c
index 8f2e491..61f3a42 100644
--- a/src/atomic_ops.c
+++ b/src/atomic_ops.c
@@ -1,23 +1,23 @@
/*
* Copyright (c) 2003 Hewlett-Packard Development Company, L.P.
- *
+ *
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
- *
+ *
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
- *
+ *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
+ * SOFTWARE.
*/
/*
@@ -64,7 +64,7 @@ pthread_mutex_t AO_pt_lock = PTHREAD_MUTEX_INITIALIZER;
/*
* Out of line compare-and-swap emulation based on test and set.
- *
+ *
* We use a small table of locks for different compare_and_swap locations.
* Before we update perform a compare-and-swap, we grab the corresponding
* lock. Different locations may hash to the same lock, but since we
@@ -79,14 +79,14 @@ pthread_mutex_t AO_pt_lock = PTHREAD_MUTEX_INITIALIZER;
#define AO_HASH(x) (((unsigned long)(x) >> 12) & (AO_HASH_SIZE-1))
AO_TS_t AO_locks[AO_HASH_SIZE] = {
- AO_TS_INITIALIZER, AO_TS_INITIALIZER,
- AO_TS_INITIALIZER, AO_TS_INITIALIZER,
- AO_TS_INITIALIZER, AO_TS_INITIALIZER,
- AO_TS_INITIALIZER, AO_TS_INITIALIZER,
- AO_TS_INITIALIZER, AO_TS_INITIALIZER,
- AO_TS_INITIALIZER, AO_TS_INITIALIZER,
- AO_TS_INITIALIZER, AO_TS_INITIALIZER,
- AO_TS_INITIALIZER, AO_TS_INITIALIZER,
+ AO_TS_INITIALIZER, AO_TS_INITIALIZER,
+ AO_TS_INITIALIZER, AO_TS_INITIALIZER,
+ AO_TS_INITIALIZER, AO_TS_INITIALIZER,
+ AO_TS_INITIALIZER, AO_TS_INITIALIZER,
+ AO_TS_INITIALIZER, AO_TS_INITIALIZER,
+ AO_TS_INITIALIZER, AO_TS_INITIALIZER,
+ AO_TS_INITIALIZER, AO_TS_INITIALIZER,
+ AO_TS_INITIALIZER, AO_TS_INITIALIZER,
};
static AO_T dummy = 1;
@@ -116,10 +116,10 @@ void AO_pause(int n)
# else
struct timeval tv;
- /* Short async-signal-safe sleep. */
- tv.tv_sec = 0;
- tv.tv_usec = (n > 28? 100000 : (1 << (n - 12)));
- select(0, 0, 0, 0, &tv);
+ /* Short async-signal-safe sleep. */
+ tv.tv_sec = 0;
+ tv.tv_usec = (n > 28? 100000 : (1 << (n - 12)));
+ select(0, 0, 0, 0, &tv);
# endif
}
}
@@ -151,7 +151,7 @@ AO_INLINE void unlock(volatile AO_TS_t *l)
static volatile AO_TS_t init_lock = AO_TS_INITIALIZER;
int AO_compare_and_swap_emulation(volatile AO_t *addr, AO_t old,
- AO_t new_val)
+ AO_t new_val)
{
AO_TS_t *my_lock = AO_locks + AO_HASH(addr);
int result;
@@ -166,13 +166,13 @@ int AO_compare_and_swap_emulation(volatile AO_t *addr, AO_t old,
AO_store_release(&initialized, 1);
}
sigprocmask(SIG_BLOCK, &all_sigs, &old_sigs);
- /* Neither sigprocmask nor pthread_sigmask is 100% */
- /* guaranteed to work here. Sigprocmask is not */
- /* guaranteed be thread safe, and pthread_sigmask */
- /* is not async-signal-safe. Under linuxthreads, */
- /* sigprocmask may block some pthreads-internal */
- /* signals. So long as we do that for short periods, */
- /* we should be OK. */
+ /* Neither sigprocmask nor pthread_sigmask is 100% */
+ /* guaranteed to work here. Sigprocmask is not */
+ /* guaranteed be thread safe, and pthread_sigmask */
+ /* is not async-signal-safe. Under linuxthreads, */
+ /* sigprocmask may block some pthreads-internal */
+ /* signals. So long as we do that for short periods, */
+ /* we should be OK. */
# endif
lock(my_lock);
if (*addr == old)
@@ -190,8 +190,8 @@ int AO_compare_and_swap_emulation(volatile AO_t *addr, AO_t old,
}
int AO_compare_double_and_swap_double_emulation(volatile AO_double_t *addr,
- AO_t old_val1, AO_t old_val2,
- AO_t new_val1, AO_t new_val2)
+ AO_t old_val1, AO_t old_val2,
+ AO_t new_val1, AO_t new_val2)
{
AO_TS_t *my_lock = AO_locks + AO_HASH(addr);
int result;
@@ -206,13 +206,13 @@ int AO_compare_double_and_swap_double_emulation(volatile AO_double_t *addr,
AO_store_release(&initialized, 1);
}
sigprocmask(SIG_BLOCK, &all_sigs, &old_sigs);
- /* Neither sigprocmask nor pthread_sigmask is 100% */
- /* guaranteed to work here. Sigprocmask is not */
- /* guaranteed be thread safe, and pthread_sigmask */
- /* is not async-signal-safe. Under linuxthreads, */
- /* sigprocmask may block some pthreads-internal */
- /* signals. So long as we do that for short periods, */
- /* we should be OK. */
+ /* Neither sigprocmask nor pthread_sigmask is 100% */
+ /* guaranteed to work here. Sigprocmask is not */
+ /* guaranteed be thread safe, and pthread_sigmask */
+ /* is not async-signal-safe. Under linuxthreads, */
+ /* sigprocmask may block some pthreads-internal */
+ /* signals. So long as we do that for short periods, */
+ /* we should be OK. */
# endif
lock(my_lock);
if (addr -> AO_val1 == old_val1 && addr -> AO_val2 == old_val2)