~ubuntu-branches/ubuntu/quantal/libgc/quantal

« back to all changes in this revision

Viewing changes to libatomic_ops-1.2/src/atomic_ops/sysdeps/emul_cas.h

  • Committer: Bazaar Package Importer
  • Author(s): Christoph Egger
  • Date: 2011-03-02 13:43:18 UTC
  • mfrom: (1.2.5 upstream) (3.1.6 sid)
  • Revision ID: james.westby@ubuntu.com-20110302134318-82ful0us5ce82qe8
Tags: 1:7.1-7
* Add ppc64 symbol file (Closes: #615469)
* Add sh4 symbol file (Closes: #614744)
* Add armhf symbol file
* Add powerpcspe symbol file
* Handle sparc64 the same as sparc
* Clear non-arch symbol file to support building on not yet captured
  architectures
* add -pthread to fix build with --no-add-needed

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright (c) 2003 by Hewlett-Packard Company.  All rights reserved.
 
3
 * 
 
4
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 
5
 * of this software and associated documentation files (the "Software"), to deal
 
6
 * in the Software without restriction, including without limitation the rights
 
7
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 
8
 * copies of the Software, and to permit persons to whom the Software is
 
9
 * furnished to do so, subject to the following conditions:
 
10
 * 
 
11
 * The above copyright notice and this permission notice shall be included in
 
12
 * all copies or substantial portions of the Software.
 
13
 * 
 
14
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 
15
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 
16
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 
17
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 
18
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 
19
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 
20
 * SOFTWARE. 
 
21
 */
 
22
 
 
23
/*
 
24
 * Ensure, if at all possible, that AO_compare_and_swap_full() is
 
25
 * available.  The emulation should be brute-force signal-safe, even
 
26
 * though it actually blocks.
 
27
 * Including this file will generate an error if AO_compare_and_swap_full()
 
28
 * cannot be made available.
 
29
 * This will be included from platform-specific atomic_ops files
 
30
 * id appropriate, and if AO_FORCE_CAS is defined.  It should not be
 
31
 * included directly, especially since it affects the implementation
 
32
 * of other atomic update primitives.
 
33
 * The implementation assumes that only AO_store_XXX and AO_test_and_set_XXX
 
34
 * variants are defined, and that AO_test_and_set_XXX is not used to
 
35
 * operate on compare_and_swap locations.
 
36
 */
 
37
 
 
38
#if !defined(ATOMIC_OPS_H)
 
39
#  error This file should not be included directly.
 
40
#endif
 
41
 
 
42
#ifndef AO_HAVE_double_t
 
43
# include "standard_ao_double_t.h"
 
44
#endif
 
45
 
 
46
int AO_compare_and_swap_emulation(volatile AO_t *addr, AO_t old,
 
47
                                  AO_t new_val);
 
48
 
 
49
int AO_compare_double_and_swap_double_emulation(volatile AO_double_t *addr,
 
50
                                                AO_t old_val1, AO_t old_val2,
 
51
                                                AO_t new_val1, AO_t new_val2);
 
52
 
 
53
void AO_store_full_emulation(volatile AO_t *addr, AO_t val);
 
54
 
 
55
#define AO_compare_and_swap_full(addr, old, newval) \
 
56
        AO_compare_and_swap_emulation(addr, old, newval)
 
57
#define AO_HAVE_compare_and_swap_full
 
58
 
 
59
#ifndef AO_HAVE_compare_double_and_swap_double
 
60
# define AO_compare_double_and_swap_double_full(addr, old1, old2, \
 
61
                                                newval1, newval2) \
 
62
         AO_compare_double_and_swap_double_emulation(addr, old1, old2, \
 
63
                                                     newval1, newval2)
 
64
# define AO_HAVE_compare_double_and_swap_double_full
 
65
#endif
 
66
 
 
67
#undef AO_store
 
68
#undef AO_HAVE_store
 
69
#undef AO_store_write
 
70
#undef AO_HAVE_store_write
 
71
#undef AO_store_release
 
72
#undef AO_HAVE_store_release
 
73
#undef AO_store_full
 
74
#undef AO_HAVE_store_full
 
75
#define AO_store_full(addr, val) AO_store_full_emulation(addr, val)
 
76
#define AO_HAVE_store_full