~fallenpegasus/drizzle/logcsv

« back to all changes in this revision

Viewing changes to plugin/innobase/ut/ut0auxconf_have_gcc_atomics.c

  • Committer: lbieber at stabletransit
  • Date: 2010-10-13 16:20:08 UTC
  • mfrom: (1843.1.3 build)
  • Revision ID: lbieber@drizzle-build-n02.wc1.dfw1.stabletransit.com-20101013162008-qi2e6k5yvfm16964
Merge Stewart - update innobase plugin to be based on innodb_plugin 1.0.6
Merge Monty - more valgrind cleanup
Merge Monty - Moved libdrizzle api listings from doxygen to sphinx

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*****************************************************************************
 
2
 
 
3
Copyright (c) 2009, Innobase Oy. All Rights Reserved.
 
4
 
 
5
This program is free software; you can redistribute it and/or modify it under
 
6
the terms of the GNU General Public License as published by the Free Software
 
7
Foundation; version 2 of the License.
 
8
 
 
9
This program is distributed in the hope that it will be useful, but WITHOUT
 
10
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 
11
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
 
12
 
 
13
You should have received a copy of the GNU General Public License along with
 
14
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
 
15
Place, Suite 330, Boston, MA 02111-1307 USA
 
16
 
 
17
*****************************************************************************/
 
18
 
 
19
/*****************************************************************************
 
20
If this program compiles and returns 0, then GCC atomic funcions are available.
 
21
 
 
22
Created September 12, 2009 Vasil Dimov
 
23
*****************************************************************************/
 
24
 
 
25
int
 
26
main(int argc, char** argv)
 
27
{
 
28
        long    x;
 
29
        long    y;
 
30
        long    res;
 
31
        char    c;
 
32
 
 
33
        x = 10;
 
34
        y = 123;
 
35
        res = __sync_bool_compare_and_swap(&x, x, y);
 
36
        if (!res || x != y) {
 
37
                return(1);
 
38
        }
 
39
 
 
40
        x = 10;
 
41
        y = 123;
 
42
        res = __sync_bool_compare_and_swap(&x, x + 1, y);
 
43
        if (res || x != 10) {
 
44
                return(1);
 
45
        }
 
46
 
 
47
        x = 10;
 
48
        y = 123;
 
49
        res = __sync_add_and_fetch(&x, y);
 
50
        if (res != 123 + 10 || x != 123 + 10) {
 
51
                return(1);
 
52
        }
 
53
 
 
54
        c = 10;
 
55
        res = __sync_lock_test_and_set(&c, 123);
 
56
        if (res != 10 || c != 123) {
 
57
                return(1);
 
58
        }
 
59
 
 
60
        return(0);
 
61
}