00001 // Filename: reMutex.h 00002 // Created by: drose (15Jan06) 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 REMUTEX_H 00016 #define REMUTEX_H 00017 00018 #include "pandabase.h" 00019 #include "mutexDebug.h" 00020 #include "reMutexDirect.h" 00021 00022 //////////////////////////////////////////////////////////////////// 00023 // Class : ReMutex 00024 // Description : A reentrant mutex. This kind of mutex can be locked 00025 // more than once by the thread that already holds it, 00026 // without deadlock. The thread must eventually release 00027 // the mutex the same number of times it locked it. 00028 // 00029 // This class inherits its implementation either from 00030 // MutexDebug or ReMutexDirect, depending on the 00031 // definition of DEBUG_THREADS. 00032 //////////////////////////////////////////////////////////////////// 00033 #ifdef DEBUG_THREADS 00034 class EXPCL_PANDA_PIPELINE ReMutex : public MutexDebug 00035 #else 00036 class EXPCL_PANDA_PIPELINE ReMutex : public ReMutexDirect 00037 #endif // DEBUG_THREADS 00038 { 00039 PUBLISHED: 00040 INLINE ReMutex(); 00041 public: 00042 INLINE ReMutex(const char *name); 00043 PUBLISHED: 00044 INLINE ReMutex(const string &name); 00045 INLINE ~ReMutex(); 00046 private: 00047 INLINE ReMutex(const ReMutex ©); 00048 INLINE void operator = (const ReMutex ©); 00049 }; 00050 00051 #include "reMutex.I" 00052 00053 #endif