00001 // Filename: atomicAdjustNsprImpl.I 00002 // Created by: drose (09Aug02) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved 00008 // 00009 // All use of this software is subject to the terms of the Panda 3d 00010 // Software license. You should have received a copy of this license 00011 // along with this source code; you will also find a current copy of 00012 // the license at http://www.panda3d.org/license.txt . 00013 // 00014 // To contact the maintainers of this program write to 00015 // panda3d@yahoogroups.com . 00016 // 00017 //////////////////////////////////////////////////////////////////// 00018 00019 00020 //////////////////////////////////////////////////////////////////// 00021 // Function: AtomicAdjustNsprImpl::inc 00022 // Access: Public, Static 00023 // Description: Atomically increments the indicated variable and 00024 // returns the new value. 00025 //////////////////////////////////////////////////////////////////// 00026 INLINE int AtomicAdjustNsprImpl:: 00027 inc(int &var) { 00028 return PR_AtomicIncrement(&var); 00029 } 00030 00031 //////////////////////////////////////////////////////////////////// 00032 // Function: AtomicAdjustNsprImpl::dec 00033 // Access: Public, Static 00034 // Description: Atomically decrements the indicated variable and 00035 // returns the new value. 00036 //////////////////////////////////////////////////////////////////// 00037 INLINE int AtomicAdjustNsprImpl:: 00038 dec(int &var) { 00039 return PR_AtomicDecrement(&var); 00040 } 00041 00042 //////////////////////////////////////////////////////////////////// 00043 // Function: AtomicAdjustNsprImpl::set 00044 // Access: Public, Static 00045 // Description: Atomically changes the indicated variable and 00046 // returns the original value. 00047 //////////////////////////////////////////////////////////////////// 00048 INLINE int AtomicAdjustNsprImpl:: 00049 set(int &var, int new_value) { 00050 return PR_AtomicSet(&var, new_value); 00051 }