mariadb/storage/innobase/win_atomics32_test.c
2009-06-16 15:16:15 +02:00

30 lines
999 B
C

/* Copyright (C) 2009 Sun Microsystems AB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
#include <windows.h>
int main()
{
volatile long var32 = 0;
long add32 = 1;
long old32 = 0;
long exch32 = 1;
long ret_value;
ret_value = InterlockedExchangeAdd(&var32, add32);
ret_value = InterlockedCompareExchange(&var32, exch32, old32);
MemoryBarrier();
return EXIT_SUCCESS;
}