Panda3D
Loading...
Searching...
No Matches
lightMutexDirect.I
Go to the documentation of this file.
1/**
2 * PANDA 3D SOFTWARE
3 * Copyright (c) Carnegie Mellon University. All rights reserved.
4 *
5 * All use of this software is subject to the terms of the revised BSD
6 * license. You should have received a copy of this license along
7 * with this source code in a file named "LICENSE."
8 *
9 * @file lightMutexDirect.I
10 * @author drose
11 * @date 2008-10-08
12 */
13
14/**
15 * Alias for acquire() to match C++11 semantics.
16 * @see acquire()
17 */
19lock() {
20 TAU_PROFILE("void LightMutexDirect::acquire()", " ", TAU_USER);
21 _impl.lock();
22}
23
24/**
25 * Alias for try_acquire() to match C++11 semantics.
26 * @see try_acquire()
27 */
29try_lock() {
30 TAU_PROFILE("void LightMutexDirect::try_acquire()", " ", TAU_USER);
31 return _impl.try_lock();
32}
33
34/**
35 * Alias for release() to match C++11 semantics.
36 * @see release()
37 */
39unlock() {
40 TAU_PROFILE("void LightMutexDirect::unlock()", " ", TAU_USER);
41 _impl.unlock();
42}
43
44/**
45 * Grabs the lightMutex if it is available. If it is not available, blocks
46 * until it becomes available, then grabs it. In either case, the function
47 * does not return until the lightMutex is held; you should then call
48 * unlock().
49 *
50 * This method is considered const so that you can lock and unlock const
51 * lightMutexes, mainly to allow thread-safe access to otherwise const data.
52 *
53 * Also see LightMutexHolder.
54 */
56acquire() const {
57 TAU_PROFILE("void LightMutexDirect::acquire()", " ", TAU_USER);
58 _impl.lock();
59}
60
61/**
62 * Releases the lightMutex. It is an error to call this if the lightMutex was
63 * not already locked.
64 *
65 * This method is considered const so that you can lock and unlock const
66 * lightMutexes, mainly to allow thread-safe access to otherwise const data.
67 */
69release() const {
70 TAU_PROFILE("void LightMutexDirect::release()", " ", TAU_USER);
71 _impl.unlock();
72}
73
74/**
75 * Returns true if the current thread has locked the LightMutex, false
76 * otherwise. This method is only intended for use in debugging, hence the
77 * method name; in the LightMutexDirect case, it always returns true, since
78 * there's not a reliable way to determine this otherwise.
79 */
81debug_is_locked() const {
82 return true;
83}
84
85/**
86 * The lightMutex name is only defined when compiling in DEBUG_THREADS mode.
87 */
89set_name(const std::string &) {
90}
91
92/**
93 * The lightMutex name is only defined when compiling in DEBUG_THREADS mode.
94 */
96clear_name() {
97}
98
99/**
100 * The lightMutex name is only defined when compiling in DEBUG_THREADS mode.
101 */
103has_name() const {
104 return false;
105}
106
107/**
108 * The lightMutex name is only defined when compiling in DEBUG_THREADS mode.
109 */
110INLINE std::string LightMutexDirect::
111get_name() const {
112 return std::string();
113}
bool has_name() const
The lightMutex name is only defined when compiling in DEBUG_THREADS mode.
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.
void unlock()
Alias for release() to match C++11 semantics.
void lock()
Alias for acquire() to match C++11 semantics.
void set_name(const std::string &name)
The lightMutex name is only defined when compiling in DEBUG_THREADS mode.
void release() const
Releases the lightMutex.
std::string get_name() const
The lightMutex name is only defined when compiling in DEBUG_THREADS mode.
void acquire() const
Grabs the lightMutex if it is available.
bool try_lock()
Alias for try_acquire() to match C++11 semantics.