author  Bob Pendleton <bob@pendleton.com> 
Wed, 24 Jun 2009 20:04:08 +0000  
changeset 3199  3e1bf2b8bd81 
parent 3187  e041d2c603fe 
child 3202  3aa519a5c676 
permissions  rwrr 
3180
77d6336711fc
First commit for SDL atomic operations.
Bob Pendleton <bob@pendleton.com>
parents:
diff
changeset

1 
/* 
77d6336711fc
First commit for SDL atomic operations.
Bob Pendleton <bob@pendleton.com>
parents:
diff
changeset

2 
SDL  Simple DirectMedia Layer 
77d6336711fc
First commit for SDL atomic operations.
Bob Pendleton <bob@pendleton.com>
parents:
diff
changeset

3 
Copyright (C) 19972006 Sam Lantinga 
77d6336711fc
First commit for SDL atomic operations.
Bob Pendleton <bob@pendleton.com>
parents:
diff
changeset

4 

77d6336711fc
First commit for SDL atomic operations.
Bob Pendleton <bob@pendleton.com>
parents:
diff
changeset

5 
This library is free software; you can redistribute it and/or 
77d6336711fc
First commit for SDL atomic operations.
Bob Pendleton <bob@pendleton.com>
parents:
diff
changeset

6 
modify it under the terms of the GNU Lesser General Public 
77d6336711fc
First commit for SDL atomic operations.
Bob Pendleton <bob@pendleton.com>
parents:
diff
changeset

7 
License as published by the Free Software Foundation; either 
77d6336711fc
First commit for SDL atomic operations.
Bob Pendleton <bob@pendleton.com>
parents:
diff
changeset

8 
version 2.1 of the License, or (at your option) any later version. 
77d6336711fc
First commit for SDL atomic operations.
Bob Pendleton <bob@pendleton.com>
parents:
diff
changeset

9 

77d6336711fc
First commit for SDL atomic operations.
Bob Pendleton <bob@pendleton.com>
parents:
diff
changeset

10 
This library is distributed in the hope that it will be useful, 
77d6336711fc
First commit for SDL atomic operations.
Bob Pendleton <bob@pendleton.com>
parents:
diff
changeset

11 
but WITHOUT ANY WARRANTY; without even the implied warranty of 
77d6336711fc
First commit for SDL atomic operations.
Bob Pendleton <bob@pendleton.com>
parents:
diff
changeset

12 
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 
77d6336711fc
First commit for SDL atomic operations.
Bob Pendleton <bob@pendleton.com>
parents:
diff
changeset

13 
Lesser General Public License for more details. 
77d6336711fc
First commit for SDL atomic operations.
Bob Pendleton <bob@pendleton.com>
parents:
diff
changeset

14 

77d6336711fc
First commit for SDL atomic operations.
Bob Pendleton <bob@pendleton.com>
parents:
diff
changeset

15 
You should have received a copy of the GNU Lesser General Public 
77d6336711fc
First commit for SDL atomic operations.
Bob Pendleton <bob@pendleton.com>
parents:
diff
changeset

16 
License along with this library; if not, write to the Free Software 
77d6336711fc
First commit for SDL atomic operations.
Bob Pendleton <bob@pendleton.com>
parents:
diff
changeset

17 
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 021101301 USA 
77d6336711fc
First commit for SDL atomic operations.
Bob Pendleton <bob@pendleton.com>
parents:
diff
changeset

18 

77d6336711fc
First commit for SDL atomic operations.
Bob Pendleton <bob@pendleton.com>
parents:
diff
changeset

19 
Sam Lantinga 
77d6336711fc
First commit for SDL atomic operations.
Bob Pendleton <bob@pendleton.com>
parents:
diff
changeset

20 
slouken@libsdl.org 
77d6336711fc
First commit for SDL atomic operations.
Bob Pendleton <bob@pendleton.com>
parents:
diff
changeset

21 
*/ 
77d6336711fc
First commit for SDL atomic operations.
Bob Pendleton <bob@pendleton.com>
parents:
diff
changeset

22 

77d6336711fc
First commit for SDL atomic operations.
Bob Pendleton <bob@pendleton.com>
parents:
diff
changeset

23 
/** 
77d6336711fc
First commit for SDL atomic operations.
Bob Pendleton <bob@pendleton.com>
parents:
diff
changeset

24 
* \file SDL_atomic.h 
77d6336711fc
First commit for SDL atomic operations.
Bob Pendleton <bob@pendleton.com>
parents:
diff
changeset

25 
* 
3199
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

26 
* Atomic operations. 
3180
77d6336711fc
First commit for SDL atomic operations.
Bob Pendleton <bob@pendleton.com>
parents:
diff
changeset

27 
*/ 
77d6336711fc
First commit for SDL atomic operations.
Bob Pendleton <bob@pendleton.com>
parents:
diff
changeset

28 

77d6336711fc
First commit for SDL atomic operations.
Bob Pendleton <bob@pendleton.com>
parents:
diff
changeset

29 
#ifndef _SDL_atomic_h_ 
77d6336711fc
First commit for SDL atomic operations.
Bob Pendleton <bob@pendleton.com>
parents:
diff
changeset

30 
#define _SDL_atomic_h_ 
77d6336711fc
First commit for SDL atomic operations.
Bob Pendleton <bob@pendleton.com>
parents:
diff
changeset

31 

77d6336711fc
First commit for SDL atomic operations.
Bob Pendleton <bob@pendleton.com>
parents:
diff
changeset

32 

77d6336711fc
First commit for SDL atomic operations.
Bob Pendleton <bob@pendleton.com>
parents:
diff
changeset

33 
#include "SDL_stdinc.h" 
77d6336711fc
First commit for SDL atomic operations.
Bob Pendleton <bob@pendleton.com>
parents:
diff
changeset

34 
#include "SDL_platform.h" 
77d6336711fc
First commit for SDL atomic operations.
Bob Pendleton <bob@pendleton.com>
parents:
diff
changeset

35 

77d6336711fc
First commit for SDL atomic operations.
Bob Pendleton <bob@pendleton.com>
parents:
diff
changeset

36 
#include "begin_code.h" 
77d6336711fc
First commit for SDL atomic operations.
Bob Pendleton <bob@pendleton.com>
parents:
diff
changeset

37 

77d6336711fc
First commit for SDL atomic operations.
Bob Pendleton <bob@pendleton.com>
parents:
diff
changeset

38 
/* Set up for C function definitions, even when using C++ */ 
77d6336711fc
First commit for SDL atomic operations.
Bob Pendleton <bob@pendleton.com>
parents:
diff
changeset

39 
#ifdef __cplusplus 
77d6336711fc
First commit for SDL atomic operations.
Bob Pendleton <bob@pendleton.com>
parents:
diff
changeset

40 
/* *INDENTOFF* */ 
77d6336711fc
First commit for SDL atomic operations.
Bob Pendleton <bob@pendleton.com>
parents:
diff
changeset

41 
extern "C" { 
77d6336711fc
First commit for SDL atomic operations.
Bob Pendleton <bob@pendleton.com>
parents:
diff
changeset

42 
/* *INDENTON* */ 
77d6336711fc
First commit for SDL atomic operations.
Bob Pendleton <bob@pendleton.com>
parents:
diff
changeset

43 
#endif 
77d6336711fc
First commit for SDL atomic operations.
Bob Pendleton <bob@pendleton.com>
parents:
diff
changeset

44 

3187
e041d2c603fe
indent is really bad at handling assembly
Sam Lantinga <slouken@libsdl.org>
parents:
3186
diff
changeset

45 
/* *INDENTOFF* */ 
3199
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

46 
/** 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

47 
* \def SDL_AtomicBusyWait32 (ptr) 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

48 
* 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

49 
* \brief Implements a simple busy wait for use with 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

50 
* SDL_AtomicTestThenSet and SDL_AtomicClear. 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

51 
* 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

52 
* Note: This can be an infinite loop. 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

53 
* 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

54 
*/ 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

55 
#define SDL_AtomicBusyWait32(ptr) \ 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

56 
{ \ 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

57 
while (!SDL_AtomicTestThenSet32(ptr) \ 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

58 
{ \ 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

59 
}; \ 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

60 
}; 
3180
77d6336711fc
First commit for SDL atomic operations.
Bob Pendleton <bob@pendleton.com>
parents:
diff
changeset

61 

3199
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

62 
/** 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

63 
* \def SDL_AtomicWait32(ptr) 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

64 
* 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

65 
* \brief A safer way to wait for a testthenset lock to be cleared. 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

66 
* 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

67 
* This assumes that the SDL_Sleep(0) call acts as a thread_yeild 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

68 
* operation. 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

69 
* 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

70 
*/ 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

71 
#define SDL_AtomicWait32(ptr) \ 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

72 
{ \ 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

73 
while (!SDL_AtomicTestThenSet32(ptr) \ 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

74 
{ \ 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

75 
SDL_Sleep(0); \ 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

76 
}; \ 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

77 
}; 
3180
77d6336711fc
First commit for SDL atomic operations.
Bob Pendleton <bob@pendleton.com>
parents:
diff
changeset

78 

3199
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

79 
/** 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

80 
* \def SDL_AtomicBusyWait64(ptr) 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

81 
* 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

82 
* \brief 64 bit version of busy wait 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

83 
* 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

84 
* \sa SDL_AtomicBusyWait32 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

85 
*/ 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

86 
#define SDL_AtomicBusyWait64(ptr) \ 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

87 
{ \ 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

88 
while (!SDL_AtomicTestThenSet64(ptr) \ 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

89 
{ \ 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

90 
}; \ 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

91 
}; 
3180
77d6336711fc
First commit for SDL atomic operations.
Bob Pendleton <bob@pendleton.com>
parents:
diff
changeset

92 

3199
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

93 
/** 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

94 
* \def SDL_AtomicWait64(ptr) 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

95 
* 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

96 
* \brief 64 bit version of SDL_AtomicWait32 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

97 
* 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

98 
* \sa SDL_AtomicWait32 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

99 
*/ 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

100 
#define SDL_AtomicWait64(ptr) \ 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

101 
{ \ 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

102 
while (!SDL_AtomicTestThenSet64(ptr) \ 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

103 
{ \ 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

104 
SDL_Sleep(0); \ 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

105 
}; \ 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

106 
}; 
3187
e041d2c603fe
indent is really bad at handling assembly
Sam Lantinga <slouken@libsdl.org>
parents:
3186
diff
changeset

107 
/* *INDENTON* */ 
3186  108 

3199
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

109 
/* Function prototypes */ 
3180
77d6336711fc
First commit for SDL atomic operations.
Bob Pendleton <bob@pendleton.com>
parents:
diff
changeset

110 

3199
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

111 
/** 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

112 
* \fn int SDL_AtomicExchange32(Uint32 * ptr, Uint32 value) 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

113 
* 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

114 
* \brief Atomically exchange two 32 bit values. 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

115 
* 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

116 
* \return the value point to by ptr. 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

117 
* 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

118 
* \param ptr points to the value to be fetched from *ptr. 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

119 
* \param value is value to be stored at *ptr. 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

120 
* 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

121 
* The current value stored at *ptr is returned and it is replaced 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

122 
* with value. This function can be used to implement SDL_TestThenSet. 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

123 
* 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

124 
*/ 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

125 
extern DECLSPEC Uint32 SDLCALL SDL_AtomicExchange32(Uint32 * ptr, Uint32 value); 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

126 
/** 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

127 
* \fn int SDL_AtomicCompareThenSet32(Uint32 * ptr, Uint32 oldvalue, Uint32 newvalue) 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

128 
* 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

129 
* \brief If *ptr == oldvalue then replace the contents of *ptr by new value. 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

130 
* 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

131 
* \return true if the newvalue was stored. 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

132 
* 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

133 
* \param *ptr is the value to be compared and replaced. 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

134 
* \param oldvalue is value to be compared to *ptr. 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

135 
* \param newvalue is value to be stored at *ptr. 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

136 
* 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

137 
*/ 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

138 
extern DECLSPEC SDL_bool SDLCALL SDL_AtomicCompareThenSet32(Uint32 * ptr, 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

139 
Uint32 oldvalue, Uint32 newvalue); 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

140 
/** 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

141 
* \fn SDL_bool SDL_AtomicTestThenSet32(Uint32 * ptr); 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

142 
* 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

143 
* \brief Check to see if *ptr == 0 and set it to nonzero. 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

144 
* 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

145 
* \return SDL_True if the value pointed to by ptr was zero and 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

146 
* SDL_False if it was not zero 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

147 
* 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

148 
* \param ptr points to the value to be tested and set. 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

149 
* 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

150 
*/ 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

151 
extern DECLSPEC SDL_bool SDLCALL SDL_AtomicTestThenSet32(Uint32 * ptr); 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

152 
/** 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

153 
* \fn void SDL_AtomicClear32(Uint32 * ptr); 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

154 
* 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

155 
* \brief set the value pointed to by ptr to be zero. 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

156 
* 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

157 
* \param ptr address of the value to be set to zero 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

158 
* 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

159 
*/ 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

160 
extern DECLSPEC void SDLCALL SDL_AtomicClear32(Uint32 * ptr); 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

161 
/** 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

162 
* \fn Uint32 SDL_AtomicFetchThenIncrement32(Uint32 * ptr); 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

163 
* 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

164 
* \brief fetch the current value of *ptr and then increment that 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

165 
* value in place. 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

166 
* 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

167 
* \return the value before it was incremented. 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

168 
* 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

169 
* \param ptr address of the value to fetch and increment 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

170 
* 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

171 
*/ 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

172 
extern DECLSPEC Uint32 SDLCALL SDL_AtomicFetchThenIncrement32(Uint32 * ptr); 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

173 
/** 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

174 
* \fn Uint32 SDL_AtomicFetchThenDecrement32(Uint32 * ptr); 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

175 
* 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

176 
* \brief fetch *ptr and then decrement the value in place. 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

177 
* 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

178 
* \return the value before it was decremented. 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

179 
* 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

180 
* \param ptr address of the value to fetch and drement 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

181 
* 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

182 
*/ 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

183 
extern DECLSPEC Uint32 SDLCALL SDL_AtomicFetchThenDecrement32(Uint32 * ptr); 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

184 
/** 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

185 
* \fn Uint32 SDL_AtomicFetchThenAdd32(Uint32 * ptr, Uint32 value); 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

186 
* 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

187 
* \brief fetch the current value at ptr and then add value to *ptr. 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

188 
* 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

189 
* \return *ptr before the addition took place. 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

190 
* 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

191 
* \param ptr the address of data we are changing. 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

192 
* \param value the value to add to *ptr. 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

193 
* 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

194 
*/ 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

195 
extern DECLSPEC Uint32 SDLCALL SDL_AtomicFetchThenAdd32(Uint32 * ptr, Uint32 value); 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

196 
/** 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

197 
* \fn Uint32 SDL_AtomicFetchThenSubtract32(Uint32 * ptr, Uint32 value); 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

198 
* 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

199 
* \brief Fetch *ptr and then subtract value from it. 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

200 
* 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

201 
* \return *ptr before the subtraction took place. 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

202 
* 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

203 
* \param ptr the address of the data being changed. 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

204 
* \param value the value to subtract from *ptr. 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

205 
* 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

206 
*/ 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

207 
extern DECLSPEC Uint32 SDLCALL SDL_AtomicFetchThenSubtract32(Uint32 * ptr, Uint32 value); 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

208 
/** 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

209 
* \fn Uint32 SDL_AtomicIncrementThenFetch32(Uint32 * ptr); 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

210 
* 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

211 
* \brief Add one to the data pointed to by ptr and return that value. 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

212 
* 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

213 
* \return the incremented value. 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

214 
* 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

215 
* \param ptr address of the data to increment. 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

216 
* 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

217 
*/ 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

218 
extern DECLSPEC Uint32 SDLCALL SDL_AtomicIncrementThenFetch32(Uint32 * ptr); 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

219 
/** 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

220 
* \fn Uint32 SDL_AtomicDecrementThenFetch32(Uint32 * ptr); 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

221 
* 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

222 
* \brief Subtract one from data pointed to by ptr and return the new value. 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

223 
* 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

224 
* \return The decremented value. 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

225 
* 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

226 
* \param ptr The address of the data to decrement. 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

227 
* 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

228 
*/ 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

229 
extern DECLSPEC Uint32 SDLCALL SDL_AtomicDecrementThenFetch32(Uint32 * ptr); 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

230 
/** 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

231 
* \fn Uint32 SDL_AtomicAddThenFetch32(Uint32 * ptr, Uint32 value); 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

232 
* 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

233 
* \brief Add value to the data pointed to by ptr and return result. 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

234 
* 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

235 
* \return The sum of *ptr and value. 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

236 
* 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

237 
* \param ptr The address of the data to be modified. 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

238 
* \param value The value to be added. 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

239 
* 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

240 
*/ 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

241 
extern DECLSPEC Uint32 SDLCALL SDL_AtomicAddThenFetch32(Uint32 * ptr, Uint32 value); 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

242 
/** 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

243 
* \fn Uint32 SDL_AtomicSubtractThenFetch32(Uint32 * ptr, Uint32 value); 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

244 
* 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

245 
* \brief Subtract value from the data pointed to by ptr and return the result. 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

246 
* 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

247 
* \return the difference between *ptr and value. 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

248 
* 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

249 
* \param ptr The address of the data to be modified. 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

250 
* \param value The value to be subtracted. 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

251 
* 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

252 
*/ 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

253 
extern DECLSPEC Uint32 SDLCALL SDL_AtomicSubtractThenFetch32(Uint32 * ptr, Uint32 value); 
3180
77d6336711fc
First commit for SDL atomic operations.
Bob Pendleton <bob@pendleton.com>
parents:
diff
changeset

254 

3199
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

255 
#ifdef SDL_HAS_64BIT_TYPE 
3180
77d6336711fc
First commit for SDL atomic operations.
Bob Pendleton <bob@pendleton.com>
parents:
diff
changeset

256 

3199
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

257 
extern DECLSPEC Uint64 SDLCALL SDL_AtomicExchange64(Uint64 * ptr, Uint64 value); 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

258 
extern DECLSPEC SDL_bool SDLCALL SDL_AtomicCompareThenSet64(Uint64 * ptr, 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

259 
Uint64 oldvalue, Uint64 newvalue); 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

260 
extern DECLSPEC SDL_bool SDLCALL SDL_AtomicTestThenSet64(Uint64 * ptr); 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

261 
extern DECLSPEC void SDLCALL SDL_AtomicClear64(Uint64 * ptr); 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

262 
extern DECLSPEC Uint64 SDLCALL SDL_AtomicFetchThenIncrement64(Uint64 * ptr); 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

263 
extern DECLSPEC Uint64 SDLCALL SDL_AtomicFetchThenDecrement64(Uint64 * ptr); 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

264 
extern DECLSPEC Uint64 SDLCALL SDL_AtomicFetchThenAdd64(Uint64 * ptr, Uint64 value); 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

265 
extern DECLSPEC Uint64 SDLCALL SDL_AtomicFetchThenSubtract64(Uint64 * ptr, Uint64 value); 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

266 
extern DECLSPEC Uint64 SDLCALL SDL_AtomicIncrementThenFetch64(Uint64 * ptr); 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

267 
extern DECLSPEC Uint64 SDLCALL SDL_AtomicDecrementThenFetch64(Uint64 * ptr); 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

268 
extern DECLSPEC Uint64 SDLCALL SDL_AtomicAddThenFetch64(Uint64 * ptr, Uint64 value); 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

269 
extern DECLSPEC Uint64 SDLCALL SDL_AtomicSubtractThenFetch64(Uint64 * ptr, Uint64 value); 
3e1bf2b8bd81
This check in updates SDL_atomic.h to reflect the new set of atomic operations in 32 and 64 bit form.
Bob Pendleton <bob@pendleton.com>
parents:
3187
diff
changeset

270 
#endif 
3180
77d6336711fc
First commit for SDL atomic operations.
Bob Pendleton <bob@pendleton.com>
parents:
diff
changeset

271 

77d6336711fc
First commit for SDL atomic operations.
Bob Pendleton <bob@pendleton.com>
parents:
diff
changeset

272 
/* Ends C function definitions when using C++ */ 
77d6336711fc
First commit for SDL atomic operations.
Bob Pendleton <bob@pendleton.com>
parents:
diff
changeset

273 
#ifdef __cplusplus 
77d6336711fc
First commit for SDL atomic operations.
Bob Pendleton <bob@pendleton.com>
parents:
diff
changeset

274 
/* *INDENTOFF* */ 
77d6336711fc
First commit for SDL atomic operations.
Bob Pendleton <bob@pendleton.com>
parents:
diff
changeset

275 
} 
77d6336711fc
First commit for SDL atomic operations.
Bob Pendleton <bob@pendleton.com>
parents:
diff
changeset

276 
/* *INDENTON* */ 
77d6336711fc
First commit for SDL atomic operations.
Bob Pendleton <bob@pendleton.com>
parents:
diff
changeset

277 
#endif 
77d6336711fc
First commit for SDL atomic operations.
Bob Pendleton <bob@pendleton.com>
parents:
diff
changeset

278 

77d6336711fc
First commit for SDL atomic operations.
Bob Pendleton <bob@pendleton.com>
parents:
diff
changeset

279 
#include "close_code.h" 
77d6336711fc
First commit for SDL atomic operations.
Bob Pendleton <bob@pendleton.com>
parents:
diff
changeset

280 

77d6336711fc
First commit for SDL atomic operations.
Bob Pendleton <bob@pendleton.com>
parents:
diff
changeset

281 
#endif /* _SDL_atomic_h_ */ 
77d6336711fc
First commit for SDL atomic operations.
Bob Pendleton <bob@pendleton.com>
parents:
diff
changeset

282 

77d6336711fc
First commit for SDL atomic operations.
Bob Pendleton <bob@pendleton.com>
parents:
diff
changeset

283 
/* vi: set ts=4 sw=4 expandtab: */ 