first commit

This commit is contained in:
2026-06-22 11:49:35 +02:00
commit d805f2ba86
619 changed files with 126873 additions and 0 deletions

View File

@ -0,0 +1,49 @@
/* -----------------------------------------------------------------------------
GSFramework
Copyright 2001-2013 Emmanuel Julien. All Rights Reserved.
----------------------------------------------------------------------------- */
#ifndef __ATOMIC_VALUE__
#define __ATOMIC_VALUE__
namespace GS {
namespace Threading {
/*!
@short 32bit atomic value.
@author Emmanuel Julien (ejulien@owloh.com)
*/
class Atomic32
{
void *v;
public:
/// Perform atomic increment, return the new value.
int Inc();
/// Perform atomic decrement, return the new value.
int Dec();
/// Return the current value.
int Get() const;
/// Set new value, return the initial value.
int Set(int);
/*!
@short Perform an atomic compare and swap operation.
Compare the current value with the comparand, if they match set the
new value. Return the initial value.
*/
int Cas(int comparand, int value);
explicit Atomic32(int value = 0);
~Atomic32();
};
} // Threading
} // GS
#endif // __ATOMIC_VALUE__