1
/*****************************************************************************
3
Copyright (c) 2009, Innobase Oy. All Rights Reserved.
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.
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.
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
17
*****************************************************************************/
19
/*****************************************************************************
20
If this program compiles and returns 0, then GCC atomic funcions are available.
22
Created September 12, 2009 Vasil Dimov
23
*****************************************************************************/
26
main(int argc, char** argv)
35
res = __sync_bool_compare_and_swap(&x, x, y);
42
res = __sync_bool_compare_and_swap(&x, x + 1, y);
49
res = __sync_add_and_fetch(&x, y);
50
if (res != 123 + 10 || x != 123 + 10) {
55
res = __sync_lock_test_and_set(&c, 123);
56
if (res != 10 || c != 123) {