Panda3D
|
00001 // Filename: mutexDirect.h 00002 // Created by: drose (13Feb06) 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 MUTEXDIRECT_H 00016 #define MUTEXDIRECT_H 00017 00018 #include "pandabase.h" 00019 #include "mutexTrueImpl.h" 00020 #include "pnotify.h" 00021 00022 class Thread; 00023 00024 #ifndef DEBUG_THREADS 00025 00026 //////////////////////////////////////////////////////////////////// 00027 // Class : MutexDirect 00028 // Description : This class implements a standard mutex by making 00029 // direct calls to the underlying implementation layer. 00030 // It doesn't perform any debugging operations. 00031 //////////////////////////////////////////////////////////////////// 00032 class EXPCL_PANDA_PIPELINE MutexDirect { 00033 protected: 00034 INLINE MutexDirect(); 00035 INLINE ~MutexDirect(); 00036 private: 00037 INLINE MutexDirect(const MutexDirect ©); 00038 INLINE void operator = (const MutexDirect ©); 00039 00040 PUBLISHED: 00041 BLOCKING INLINE void acquire() const; 00042 BLOCKING INLINE bool try_acquire() const; 00043 INLINE void release() const; 00044 INLINE bool debug_is_locked() const; 00045 00046 INLINE void set_name(const string &name); 00047 INLINE void clear_name(); 00048 INLINE bool has_name() const; 00049 INLINE string get_name() const; 00050 00051 void output(ostream &out) const; 00052 00053 private: 00054 MutexTrueImpl _impl; 00055 00056 friend class ConditionVarDirect; 00057 friend class ConditionVarFullDirect; 00058 }; 00059 00060 INLINE ostream & 00061 operator << (ostream &out, const MutexDirect &m) { 00062 m.output(out); 00063 return out; 00064 } 00065 00066 #include "mutexDirect.I" 00067 00068 #endif // !DEBUG_THREADS 00069 00070 #endif