Commit 386dceed authored by Bob Pendleton's avatar Bob Pendleton

This check in updates SDL_atomic.h to reflect the new set of atomic operations...

This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
It also update configure.in to compile the linux version of the library. The three versions are all dummies
implementations that do nothing. They are being checked in as place holders. Mostly, I just wanted to get
place holders and the configure.in checked in.

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403667
parent 36883826
...@@ -217,6 +217,12 @@ SOURCES="$SOURCES $srcdir/src/video/*.c" ...@@ -217,6 +217,12 @@ SOURCES="$SOURCES $srcdir/src/video/*.c"
dnl Enable/disable various subsystems of the SDL library dnl Enable/disable various subsystems of the SDL library
AC_ARG_ENABLE(atomic,
AC_HELP_STRING([--enable-atomic], [Enable the atomic operations subsystem [[default=yes]]]),
, enable_atomic=yes)
if test x$enable_atomic != xyes; then
AC_DEFINE(SDL_ATOMIC_DISABLED)
fi
AC_ARG_ENABLE(audio, AC_ARG_ENABLE(audio,
AC_HELP_STRING([--enable-audio], [Enable the audio subsystem [[default=yes]]]), AC_HELP_STRING([--enable-audio], [Enable the audio subsystem [[default=yes]]]),
, enable_audio=yes) , enable_audio=yes)
...@@ -2433,6 +2439,16 @@ case "$host" in ...@@ -2433,6 +2439,16 @@ case "$host" in
;; ;;
esac esac
fi fi
# Set up files for the atomic operations library
if test x$enable_atomic = xyes; then
case $ARCH in
linux)
AC_DEFINE(SDL_ATOMIC_LINUX)
SOURCES="$SOURCES $srcdir/src/atomic/linux/*.c"
have_atomic=yes
;;
esac
fi
# Set up files for the joystick library # Set up files for the joystick library
if test x$enable_joystick = xyes; then if test x$enable_joystick = xyes; then
case $ARCH in case $ARCH in
......
This diff is collapsed.
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997-2009 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Sam Lantinga
slouken@libsdl.org
*/
#ifdef SDL_ATOMIC_LINUX
#include "SDL.h"
#include "SDL_config.h"
#include "SDL_atomic.h"
Uint32
SDL_AtomicExchange32(Uint32 * ptr, Uint32 value)
{
return 0;
}
SDL_bool
SDL_AtomicCompareThenSet32(Uint32 * ptr, Uint32 oldvalue, Uint32 newvalue)
{
return SDL_false;
}
SDL_bool
SDL_AtomicTestThenSet32(Uint32 * ptr)
{
return SDL_false;
}
void
SDL_AtomicClear32(Uint32 * ptr)
{
}
Uint32
SDL_AtomicFetchThenIncrement32(Uint32 * ptr)
{
return 0;
}
Uint32
SDL_AtomicFetchThenDecrement32(Uint32 * ptr)
{
return 0;
}
Uint32
SDL_AtomicFetchThenAdd32(Uint32 * ptr, Uint32 value)
{
return 0;
}
Uint32
SDL_AtomicFetchThenSubtract32(Uint32 * ptr, Uint32 value)
{
return 0;
}
Uint32
SDL_AtomicIncrementThenFetch32(Uint32 * ptr)
{
return 0;
}
Uint32
SDL_AtomicDecrementThenFetch32(Uint32 * ptr)
{
return 0;
}
Uint32
SDL_AtomicAddThenFetch32(Uint32 * ptr, Uint32 value)
{
return 0;
}
Uint32
SDL_AtomicSubtractThenFetch32(Uint32 * ptr, Uint32 value)
{
return 0;
}
#ifdef SDL_HAS_64BIT_TYPE
Uint64
SDL_AtomicExchange64(Uint64 * ptr, Uint64 value)
{
return 0;
}
SDL_bool
SDL_AtomicCompareThenSet64(Uint64 * ptr,
Uint64 oldvalue, Uint64 newvalue)
{
return SDL_false;
}
SDL_bool
SDL_AtomicTestThenSet64(Uint64 * ptr)
{
return SDL_false;
}
void
SDL_AtomicClear64(Uint64 * ptr)
{
}
Uint64
SDL_AtomicFetchThenIncrement64(Uint64 * ptr)
{
return 0;
}
Uint64
SDL_AtomicFetchThenDecrement64(Uint64 * ptr)
{
return 0;
}
Uint64
SDL_AtomicFetchThenAdd64(Uint64 * ptr, Uint64 value)
{
return 0;
}
Uint64
SDL_AtomicFetchThenSubtract64(Uint64 * ptr, Uint64 value)
{
return 0;
}
Uint64
SDL_AtomicIncrementThenFetch64(Uint64 * ptr)
{
return 0;
}
Uint64
SDL_AtomicDecrementThenFetch64(Uint64 * ptr)
{
return 0;
}
Uint64
SDL_AtomicAddThenFetch64(Uint64 * ptr, Uint64 value)
{
return 0;
}
Uint64
SDL_AtomicSubtractThenFetch64(Uint64 * ptr, Uint64 value)
{
return 0;
}
#endif
#endif
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997-2009 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Sam Lantinga
slouken@libsdl.org
*/
#ifdef SDL_ATOMIC_LINUX
#include "SDL.h"
#include "SDL_config.h"
#include "SDL_atomic.h"
Uint32
SDL_AtomicExchange32(Uint32 * ptr, Uint32 value)
{
return 0;
}
SDL_bool
SDL_AtomicCompareThenSet32(Uint32 * ptr, Uint32 oldvalue, Uint32 newvalue)
{
return SDL_false;
}
SDL_bool
SDL_AtomicTestThenSet32(Uint32 * ptr)
{
return SDL_false;
}
void
SDL_AtomicClear32(Uint32 * ptr)
{
}
Uint32
SDL_AtomicFetchThenIncrement32(Uint32 * ptr)
{
return 0;
}
Uint32
SDL_AtomicFetchThenDecrement32(Uint32 * ptr)
{
return 0;
}
Uint32
SDL_AtomicFetchThenAdd32(Uint32 * ptr, Uint32 value)
{
return 0;
}
Uint32
SDL_AtomicFetchThenSubtract32(Uint32 * ptr, Uint32 value)
{
return 0;
}
Uint32
SDL_AtomicIncrementThenFetch32(Uint32 * ptr)
{
return 0;
}
Uint32
SDL_AtomicDecrementThenFetch32(Uint32 * ptr)
{
return 0;
}
Uint32
SDL_AtomicAddThenFetch32(Uint32 * ptr, Uint32 value)
{
return 0;
}
Uint32
SDL_AtomicSubtractThenFetch32(Uint32 * ptr, Uint32 value)
{
return 0;
}
#ifdef SDL_HAS_64BIT_TYPE
Uint64
SDL_AtomicExchange64(Uint64 * ptr, Uint64 value)
{
return 0;
}
SDL_bool
SDL_AtomicCompareThenSet64(Uint64 * ptr,
Uint64 oldvalue, Uint64 newvalue)
{
return SDL_false;
}
SDL_bool
SDL_AtomicTestThenSet64(Uint64 * ptr)
{
return SDL_false;
}
void
SDL_AtomicClear64(Uint64 * ptr)
{
}
Uint64
SDL_AtomicFetchThenIncrement64(Uint64 * ptr)
{
return 0;
}
Uint64
SDL_AtomicFetchThenDecrement64(Uint64 * ptr)
{
return 0;
}
Uint64
SDL_AtomicFetchThenAdd64(Uint64 * ptr, Uint64 value)
{
return 0;
}
Uint64
SDL_AtomicFetchThenSubtract64(Uint64 * ptr, Uint64 value)
{
return 0;
}
Uint64
SDL_AtomicIncrementThenFetch64(Uint64 * ptr)
{
return 0;
}
Uint64
SDL_AtomicDecrementThenFetch64(Uint64 * ptr)
{
return 0;
}
Uint64
SDL_AtomicAddThenFetch64(Uint64 * ptr, Uint64 value)
{
return 0;
}
Uint64
SDL_AtomicSubtractThenFetch64(Uint64 * ptr, Uint64 value)
{
return 0;
}
#endif
#endif
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997-2009 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Sam Lantinga
slouken@libsdl.org
*/
#ifdef SDL_ATOMIC_LINUX
#include "SDL.h"
#include "SDL_config.h"
#include "SDL_atomic.h"
Uint32
SDL_AtomicExchange32(Uint32 * ptr, Uint32 value)
{
return 0;
}
SDL_bool
SDL_AtomicCompareThenSet32(Uint32 * ptr, Uint32 oldvalue, Uint32 newvalue)
{
return SDL_false;
}
SDL_bool
SDL_AtomicTestThenSet32(Uint32 * ptr)
{
return SDL_false;
}
void
SDL_AtomicClear32(Uint32 * ptr)
{
}
Uint32
SDL_AtomicFetchThenIncrement32(Uint32 * ptr)
{
return 0;
}
Uint32
SDL_AtomicFetchThenDecrement32(Uint32 * ptr)
{
return 0;
}
Uint32
SDL_AtomicFetchThenAdd32(Uint32 * ptr, Uint32 value)
{
return 0;
}
Uint32
SDL_AtomicFetchThenSubtract32(Uint32 * ptr, Uint32 value)
{
return 0;
}
Uint32
SDL_AtomicIncrementThenFetch32(Uint32 * ptr)
{
return 0;
}
Uint32
SDL_AtomicDecrementThenFetch32(Uint32 * ptr)
{
return 0;
}
Uint32
SDL_AtomicAddThenFetch32(Uint32 * ptr, Uint32 value)
{
return 0;
}
Uint32
SDL_AtomicSubtractThenFetch32(Uint32 * ptr, Uint32 value)
{
return 0;
}
#ifdef SDL_HAS_64BIT_TYPE
Uint64
SDL_AtomicExchange64(Uint64 * ptr, Uint64 value)
{
return 0;
}
SDL_bool
SDL_AtomicCompareThenSet64(Uint64 * ptr,
Uint64 oldvalue, Uint64 newvalue)
{
return SDL_false;
}
SDL_bool
SDL_AtomicTestThenSet64(Uint64 * ptr)
{
return SDL_false;
}
void
SDL_AtomicClear64(Uint64 * ptr)
{
}
Uint64
SDL_AtomicFetchThenIncrement64(Uint64 * ptr)
{
return 0;
}
Uint64
SDL_AtomicFetchThenDecrement64(Uint64 * ptr)
{
return 0;
}
Uint64
SDL_AtomicFetchThenAdd64(Uint64 * ptr, Uint64 value)
{
return 0;
}
Uint64
SDL_AtomicFetchThenSubtract64(Uint64 * ptr, Uint64 value)
{
return 0;
}
Uint64
SDL_AtomicIncrementThenFetch64(Uint64 * ptr)
{
return 0;
}
Uint64
SDL_AtomicDecrementThenFetch64(Uint64 * ptr)
{
return 0;
}
Uint64
SDL_AtomicAddThenFetch64(Uint64 * ptr, Uint64 value)
{
return 0;
}
Uint64
SDL_AtomicSubtractThenFetch64(Uint64 * ptr, Uint64 value)
{
return 0;
}
#endif
#endif
...@@ -3,62 +3,62 @@ ...@@ -3,62 +3,62 @@
int int
main(int argc, char **argv) main(int argc, char **argv)
{ {
int rv = 10; /* int rv = 10; */
volatile int atomic; /* volatile int atomic; */
SDL_atomic_int_set(&atomic, 10); /* SDL_atomic_int_set(&atomic, 10); */
if (SDL_atomic_int_get(&atomic) != 10) /* if (SDL_atomic_int_get(&atomic) != 10) */
printf("Error: "); /* printf("Error: "); */
printf("SDL_atomic_int_set(atomic, 10): atomic-> %d\n", /* printf("SDL_atomic_int_set(atomic, 10): atomic-> %d\n", */
SDL_atomic_int_get(&atomic)); /* SDL_atomic_int_get(&atomic)); */
SDL_atomic_int_add(&atomic, 10); /* SDL_atomic_int_add(&atomic, 10); */
if (SDL_atomic_int_get(&atomic) != 20) /* if (SDL_atomic_int_get(&atomic) != 20) */
printf("Error: "); /* printf("Error: "); */
printf("SDL_atomic_int_add(atomic, 10): atomic-> %d\n", /* printf("SDL_atomic_int_add(atomic, 10): atomic-> %d\n", */
SDL_atomic_int_get(&atomic)); /* SDL_atomic_int_get(&atomic)); */
rv = SDL_atomic_int_cmp_xchg(&atomic, 20, 30); /* rv = SDL_atomic_int_cmp_xchg(&atomic, 20, 30); */
if (rv != SDL_TRUE || SDL_atomic_int_get(&atomic) != 30) /* if (rv != SDL_TRUE || SDL_atomic_int_get(&atomic) != 30) */
printf("Error: "); /* printf("Error: "); */
printf("SDL_atomic_int_cmp_xchg(atomic, 20, 30): rv-> %d, atomic-> %d\n", /* printf("SDL_atomic_int_cmp_xchg(atomic, 20, 30): rv-> %d, atomic-> %d\n", */
rv, SDL_atomic_int_get(&atomic)); /* rv, SDL_atomic_int_get(&atomic)); */
rv = SDL_atomic_int_cmp_xchg(&atomic, 20, 30); /* rv = SDL_atomic_int_cmp_xchg(&atomic, 20, 30); */
if (rv != SDL_FALSE || SDL_atomic_int_get(&atomic) != 30) /* if (rv != SDL_FALSE || SDL_atomic_int_get(&atomic) != 30) */
printf("Error: "); /* printf("Error: "); */
printf("SDL_atomic_int_cmp_xchg(atomic, 20, 40): rv-> %d, atomic-> %d\n", /* printf("SDL_atomic_int_cmp_xchg(atomic, 20, 40): rv-> %d, atomic-> %d\n", */
rv, SDL_atomic_int_get(&atomic)); /* rv, SDL_atomic_int_get(&atomic)); */
rv = SDL_atomic_int_xchg_add(&atomic, 10); /* rv = SDL_atomic_int_xchg_add(&atomic, 10); */
if (rv != 30 || SDL_atomic_int_get(&atomic) != 40) /* if (rv != 30 || SDL_atomic_int_get(&atomic) != 40) */
printf("Error: "); /* printf("Error: "); */
printf("SDL_atomic_int_xchg_add(atomic, 10): rv-> %d, atomic-> %d\n", /* printf("SDL_atomic_int_xchg_add(atomic, 10): rv-> %d, atomic-> %d\n", */
rv, SDL_atomic_int_get(&atomic)); /* rv, SDL_atomic_int_get(&atomic)); */
SDL_atomic_int_inc(&atomic); /* SDL_atomic_int_inc(&atomic); */
if (SDL_atomic_int_get(&atomic) != 41) /* if (SDL_atomic_int_get(&atomic) != 41) */
printf("Error: "); /* printf("Error: "); */
printf("SDL_atomic_int_inc(atomic): atomic-> %d\n", /* printf("SDL_atomic_int_inc(atomic): atomic-> %d\n", */
SDL_atomic_int_get(&atomic)); /* SDL_atomic_int_get(&atomic)); */
rv = SDL_atomic_int_dec_test(&atomic); /* rv = SDL_atomic_int_dec_test(&atomic); */
if (rv != SDL_FALSE || SDL_atomic_int_get(&atomic) != 40) /* if (rv != SDL_FALSE || SDL_atomic_int_get(&atomic) != 40) */
printf("Error: "); /* printf("Error: "); */
printf("SDL_atomic_int_dec_test(atomic): rv-> %d, atomic-> %d\n", /* printf("SDL_atomic_int_dec_test(atomic): rv-> %d, atomic-> %d\n", */
rv, SDL_atomic_int_get(&atomic)); /* rv, SDL_atomic_int_get(&atomic)); */
SDL_atomic_int_set(&atomic, 1); /* SDL_atomic_int_set(&atomic, 1); */
if (SDL_atomic_int_get(&atomic) != 1) /* if (SDL_atomic_int_get(&atomic) != 1) */
printf("Error: "); /* printf("Error: "); */
printf("SDL_atomic_int_set(atomic, 1): atomic-> %d\n", /* printf("SDL_atomic_int_set(atomic, 1): atomic-> %d\n", */
SDL_atomic_int_get(&atomic)); /* SDL_atomic_int_get(&atomic)); */
rv = SDL_atomic_int_dec_test(&atomic); /* rv = SDL_atomic_int_dec_test(&atomic); */
if (rv != SDL_TRUE || SDL_atomic_int_get(&atomic) != 0) /* if (rv != SDL_TRUE || SDL_atomic_int_get(&atomic) != 0) */
printf("Error: "); /* printf("Error: "); */
printf("SDL_atomic_int_dec_test(atomic): rv-> %d, atomic-> %d\n", /* printf("SDL_atomic_int_dec_test(atomic): rv-> %d, atomic-> %d\n", */
rv, SDL_atomic_int_get(&atomic)); /* rv, SDL_atomic_int_get(&atomic)); */
return 0; return 0;
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment