Panda3D
 All Classes Functions Variables Enumerations
atomicAdjustDummyImpl.h
1 // Filename: atomicAdjustDummyImpl.h
2 // Created by: drose (09Aug02)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 #ifndef ATOMICADJUSTDUMMYIMPL_H
16 #define ATOMICADJUSTDUMMYIMPL_H
17 
18 #include "dtoolbase.h"
19 #include "selectThreadImpl.h"
20 
21 #include "numeric_types.h"
22 
23 ////////////////////////////////////////////////////////////////////
24 // Class : AtomicAdjustDummyImpl
25 // Description : A trivial implementation for atomic adjustments for
26 // systems that don't require multiprogramming, and
27 // therefore don't require special atomic operations.
28 ////////////////////////////////////////////////////////////////////
29 class EXPCL_DTOOL AtomicAdjustDummyImpl {
30 public:
31  typedef long Integer;
32  typedef void *Pointer;
33 
34  INLINE static void inc(TVOLATILE Integer &var);
35  INLINE static bool dec(TVOLATILE Integer &var);
36  INLINE static void add(TVOLATILE Integer &var, Integer delta);
37  INLINE static Integer set(TVOLATILE Integer &var, Integer new_value);
38  INLINE static Integer get(const TVOLATILE Integer &var);
39 
40  INLINE static Pointer set_ptr(TVOLATILE Pointer &var, Pointer new_value);
41  INLINE static Pointer get_ptr(const TVOLATILE Pointer &var);
42 
43  INLINE static Integer compare_and_exchange(TVOLATILE Integer &mem,
44  Integer old_value,
45  Integer new_value);
46 
47  INLINE static Pointer compare_and_exchange_ptr(TVOLATILE Pointer &mem,
48  Pointer old_value,
49  Pointer new_value);
50 };
51 
52 #include "atomicAdjustDummyImpl.I"
53 
54 #endif
A trivial implementation for atomic adjustments for systems that don't require multiprogramming, and therefore don't require special atomic operations.