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