Panda3D
|
00001 // Filename: atomicAdjustDummyImpl.h 00002 // Created by: drose (09Aug02) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) Carnegie Mellon University. All rights reserved. 00008 // 00009 // All use of this software is subject to the terms of the revised BSD 00010 // license. You should have received a copy of this license along 00011 // with this source code in a file named "LICENSE." 00012 // 00013 //////////////////////////////////////////////////////////////////// 00014 00015 #ifndef ATOMICADJUSTDUMMYIMPL_H 00016 #define ATOMICADJUSTDUMMYIMPL_H 00017 00018 #include "dtoolbase.h" 00019 #include "selectThreadImpl.h" 00020 00021 #include "numeric_types.h" 00022 00023 //////////////////////////////////////////////////////////////////// 00024 // Class : AtomicAdjustDummyImpl 00025 // Description : A trivial implementation for atomic adjustments for 00026 // systems that don't require multiprogramming, and 00027 // therefore don't require special atomic operations. 00028 //////////////////////////////////////////////////////////////////// 00029 class EXPCL_DTOOL AtomicAdjustDummyImpl { 00030 public: 00031 typedef long Integer; 00032 00033 INLINE static void inc(TVOLATILE Integer &var); 00034 INLINE static bool dec(TVOLATILE Integer &var); 00035 INLINE static void add(TVOLATILE Integer &var, Integer delta); 00036 INLINE static Integer set(TVOLATILE Integer &var, Integer new_value); 00037 INLINE static Integer get(const TVOLATILE Integer &var); 00038 00039 INLINE static void *set_ptr(void * TVOLATILE &var, void *new_value); 00040 INLINE static void *get_ptr(void * const TVOLATILE &var); 00041 00042 INLINE static Integer compare_and_exchange(TVOLATILE Integer &mem, 00043 Integer old_value, 00044 Integer new_value); 00045 00046 INLINE static void *compare_and_exchange_ptr(void * TVOLATILE &mem, 00047 void *old_value, 00048 void *new_value); 00049 }; 00050 00051 #include "atomicAdjustDummyImpl.I" 00052 00053 #endif