Panda3D
|
00001 // Filename: lightReMutexDirect.h 00002 // Created by: drose (08Oct08) 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 LIGHTREMUTEXDIRECT_H 00016 #define LIGHTREMUTEXDIRECT_H 00017 00018 #include "pandabase.h" 00019 #include "mutexImpl.h" 00020 #include "reMutexDirect.h" 00021 00022 class Thread; 00023 00024 #ifndef DEBUG_THREADS 00025 00026 //////////////////////////////////////////////////////////////////// 00027 // Class : LightReMutexDirect 00028 // Description : This class implements a standard lightReMutex by making 00029 // direct calls to the underlying implementation layer. 00030 // It doesn't perform any debugging operations. 00031 //////////////////////////////////////////////////////////////////// 00032 class EXPCL_PANDA_PIPELINE LightReMutexDirect { 00033 protected: 00034 INLINE LightReMutexDirect(); 00035 INLINE ~LightReMutexDirect(); 00036 private: 00037 INLINE LightReMutexDirect(const LightReMutexDirect ©); 00038 INLINE void operator = (const LightReMutexDirect ©); 00039 00040 PUBLISHED: 00041 BLOCKING INLINE void acquire() const; 00042 BLOCKING INLINE void acquire(Thread *current_thread) const; 00043 INLINE void elevate_lock() const; 00044 INLINE void release() const; 00045 00046 INLINE bool debug_is_locked() const; 00047 00048 INLINE void set_name(const string &name); 00049 INLINE void clear_name(); 00050 INLINE bool has_name() const; 00051 INLINE string get_name() const; 00052 00053 void output(ostream &out) const; 00054 00055 private: 00056 #if defined(HAVE_REMUTEXIMPL) && !defined(DO_PSTATS) 00057 ReMutexImpl _impl; 00058 00059 #else 00060 // If we don't have a reentrant mutex, use the one we hand-rolled in 00061 // ReMutexDirect. 00062 ReMutexDirect _impl; 00063 #endif // HAVE_REMUTEXIMPL 00064 }; 00065 00066 INLINE ostream & 00067 operator << (ostream &out, const LightReMutexDirect &m) { 00068 m.output(out); 00069 return out; 00070 } 00071 00072 #include "lightReMutexDirect.I" 00073 00074 #endif // !DEBUG_THREADS 00075 00076 #endif