Panda3D
mutexDirect.h
1 // Filename: mutexDirect.h
2 // Created by: drose (13Feb06)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 #ifndef MUTEXDIRECT_H
16 #define MUTEXDIRECT_H
17 
18 #include "pandabase.h"
19 #include "mutexTrueImpl.h"
20 #include "pnotify.h"
21 
22 class Thread;
23 
24 #ifndef DEBUG_THREADS
25 
26 ////////////////////////////////////////////////////////////////////
27 // Class : MutexDirect
28 // Description : This class implements a standard mutex by making
29 // direct calls to the underlying implementation layer.
30 // It doesn't perform any debugging operations.
31 ////////////////////////////////////////////////////////////////////
32 class EXPCL_PANDA_PIPELINE MutexDirect {
33 protected:
34  INLINE MutexDirect();
35  INLINE ~MutexDirect();
36 private:
37  INLINE MutexDirect(const MutexDirect &copy);
38  INLINE void operator = (const MutexDirect &copy);
39 
40 PUBLISHED:
41  BLOCKING INLINE void acquire() const;
42  BLOCKING INLINE bool try_acquire() const;
43  INLINE void release() const;
44  INLINE bool debug_is_locked() const;
45 
46  INLINE void set_name(const string &name);
47  INLINE void clear_name();
48  INLINE bool has_name() const;
49  INLINE string get_name() const;
50 
51  void output(ostream &out) const;
52 
53 private:
54  MutexTrueImpl _impl;
55 
56  friend class ConditionVarDirect;
57  friend class ConditionVarFullDirect;
58 };
59 
60 INLINE ostream &
61 operator << (ostream &out, const MutexDirect &m) {
62  m.output(out);
63  return out;
64 }
65 
66 #include "mutexDirect.I"
67 
68 #endif // !DEBUG_THREADS
69 
70 #endif
A condition variable, usually used to communicate information about changing state to a thread that i...
void output(ostream &out) const
This method is declared virtual in MutexDebug, but non-virtual in MutexDirect.
Definition: mutexDirect.cxx:26
A thread; that is, a lightweight process.
Definition: thread.h:51
A fake mutex implementation for single-threaded applications that don&#39;t need any synchronization cont...
A condition variable, usually used to communicate information about changing state to a thread that i...
This class implements a standard mutex by making direct calls to the underlying implementation layer...
Definition: mutexDirect.h:32