Panda3D
 All Classes Functions Variables Enumerations
lightMutexDirect.I
1 // Filename: lightMutexDirect.I
2 // Created by: drose (08Oct08)
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 
16 ////////////////////////////////////////////////////////////////////
17 // Function: LightMutexDirect::Constructor
18 // Access: Protected
19 // Description:
20 ////////////////////////////////////////////////////////////////////
21 INLINE LightMutexDirect::
22 LightMutexDirect() {
23 }
24 
25 ////////////////////////////////////////////////////////////////////
26 // Function: LightMutexDirect::Destructor
27 // Access: Protected
28 // Description:
29 ////////////////////////////////////////////////////////////////////
30 INLINE LightMutexDirect::
31 ~LightMutexDirect() {
32 }
33 
34 ////////////////////////////////////////////////////////////////////
35 // Function: LightMutexDirect::Copy Constructor
36 // Access: Private
37 // Description: Do not attempt to copy lightMutexes.
38 ////////////////////////////////////////////////////////////////////
39 INLINE LightMutexDirect::
40 LightMutexDirect(const LightMutexDirect &copy) {
41  nassertv(false);
42 }
43 
44 ////////////////////////////////////////////////////////////////////
45 // Function: LightMutexDirect::Copy Assignment Operator
46 // Access: Private
47 // Description: Do not attempt to copy lightMutexes.
48 ////////////////////////////////////////////////////////////////////
49 INLINE void LightMutexDirect::
50 operator = (const LightMutexDirect &copy) {
51  nassertv(false);
52 }
53 
54 ////////////////////////////////////////////////////////////////////
55 // Function: LightMutexDirect::acquire
56 // Access: Published
57 // Description: Grabs the lightMutex if it is available. If it is not
58 // available, blocks until it becomes available, then
59 // grabs it. In either case, the function does not
60 // return until the lightMutex is held; you should then call
61 // unlock().
62 //
63 // This method is considered const so that you can lock
64 // and unlock const lightMutexes, mainly to allow thread-safe
65 // access to otherwise const data.
66 //
67 // Also see LightMutexHolder.
68 ////////////////////////////////////////////////////////////////////
69 INLINE void LightMutexDirect::
70 acquire() const {
71  TAU_PROFILE("void LightMutexDirect::acquire()", " ", TAU_USER);
72  ((LightMutexDirect *)this)->_impl.acquire();
73 }
74 
75 ////////////////////////////////////////////////////////////////////
76 // Function: LightMutexDirect::release
77 // Access: Published
78 // Description: Releases the lightMutex. It is an error to call this if
79 // the lightMutex was not already locked.
80 //
81 // This method is considered const so that you can lock
82 // and unlock const lightMutexes, mainly to allow thread-safe
83 // access to otherwise const data.
84 ////////////////////////////////////////////////////////////////////
85 INLINE void LightMutexDirect::
86 release() const {
87  TAU_PROFILE("void LightMutexDirect::release()", " ", TAU_USER);
88  ((LightMutexDirect *)this)->_impl.release();
89 }
90 
91 ////////////////////////////////////////////////////////////////////
92 // Function: LightMutexDirect::debug_is_locked
93 // Access: Published
94 // Description: Returns true if the current thread has locked the
95 // LightMutex, false otherwise. This method is only intended
96 // for use in debugging, hence the method name; in the
97 // LightMutexDirect case, it always returns true, since
98 // there's not a reliable way to determine this
99 // otherwise.
100 ////////////////////////////////////////////////////////////////////
101 INLINE bool LightMutexDirect::
103  return true;
104 }
105 
106 ////////////////////////////////////////////////////////////////////
107 // Function: LightMutexDirect::set_name
108 // Access: Public
109 // Description: The lightMutex name is only defined when compiling in
110 // DEBUG_THREADS mode.
111 ////////////////////////////////////////////////////////////////////
112 INLINE void LightMutexDirect::
113 set_name(const string &) {
114 }
115 
116 ////////////////////////////////////////////////////////////////////
117 // Function: LightMutexDirect::clear_name
118 // Access: Public
119 // Description: The lightMutex name is only defined when compiling in
120 // DEBUG_THREADS mode.
121 ////////////////////////////////////////////////////////////////////
122 INLINE void LightMutexDirect::
124 }
125 
126 ////////////////////////////////////////////////////////////////////
127 // Function: LightMutexDirect::has_name
128 // Access: Public
129 // Description: The lightMutex name is only defined when compiling in
130 // DEBUG_THREADS mode.
131 ////////////////////////////////////////////////////////////////////
132 INLINE bool LightMutexDirect::
133 has_name() const {
134  return false;
135 }
136 
137 ////////////////////////////////////////////////////////////////////
138 // Function: LightMutexDirect::get_name
139 // Access: Public
140 // Description: The lightMutex name is only defined when compiling in
141 // DEBUG_THREADS mode.
142 ////////////////////////////////////////////////////////////////////
143 INLINE string LightMutexDirect::
144 get_name() const {
145  return string();
146 }
This class implements a lightweight Mutex by making direct calls to the underlying implementation lay...
void release() const
Releases the lightMutex.
void acquire() const
Grabs the lightMutex if it is available.
bool debug_is_locked() const
Returns true if the current thread has locked the LightMutex, false otherwise.
void clear_name()
The lightMutex name is only defined when compiling in DEBUG_THREADS mode.
bool has_name() const
The lightMutex name is only defined when compiling in DEBUG_THREADS mode.
void set_name(const string &name)
The lightMutex name is only defined when compiling in DEBUG_THREADS mode.
string get_name() const
The lightMutex name is only defined when compiling in DEBUG_THREADS mode.