Panda3D
panda
src
pipeline
reMutexDirect.h
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 reMutexDirect.h
10
* @author drose
11
* @date 2006-02-13
12
*/
13
14
#ifndef REMUTEXDIRECT_H
15
#define REMUTEXDIRECT_H
16
17
#include "
pandabase.h
"
18
#include "
mutexTrueImpl.h
"
19
#include "
conditionVarImpl.h
"
20
#include "
thread.h
"
21
22
#ifndef DEBUG_THREADS
23
24
/**
25
* This class implements a standard reMutex by making direct calls to the
26
* underlying implementation layer. It doesn't perform any debugging
27
* operations.
28
*/
29
class
EXPCL_PANDA_PIPELINE
ReMutexDirect
{
30
protected
:
31
INLINE
ReMutexDirect
();
32
ReMutexDirect
(
const
ReMutexDirect
©) =
delete
;
33
~
ReMutexDirect
() =
default
;
34
35
void
operator = (
const
ReMutexDirect
©) =
delete
;
36
37
public
:
38
INLINE
void
lock();
39
INLINE
bool
try_lock();
40
INLINE
void
unlock();
41
42
PUBLISHED:
43
BLOCKING INLINE
void
acquire()
const
;
44
BLOCKING INLINE
void
acquire(
Thread
*current_thread)
const
;
45
BLOCKING INLINE
bool
try_acquire()
const
;
46
BLOCKING INLINE
bool
try_acquire(
Thread
*current_thread)
const
;
47
INLINE
void
elevate_lock()
const
;
48
INLINE
void
release()
const
;
49
50
INLINE
bool
debug_is_locked()
const
;
51
52
INLINE
void
set_name(
const
std::string &name);
53
INLINE
void
clear_name();
54
INLINE
bool
has_name()
const
;
55
INLINE std::string get_name()
const
;
56
57
void
output(std::ostream &out)
const
;
58
59
private
:
60
#ifdef HAVE_REMUTEXTRUEIMPL
61
mutable
ReMutexTrueImpl _impl;
62
63
#else
64
// If we don't have a reentrant mutex, we have to hand-roll one.
65
INLINE
void
do_lock();
66
void
do_lock(
Thread
*current_thread);
67
INLINE
bool
do_try_lock();
68
bool
do_try_lock(
Thread
*current_thread);
69
void
do_elevate_lock();
70
void
do_unlock(
Thread
*current_thread = Thread::get_current_thread());
71
72
Thread
*_locking_thread;
73
int
_lock_count;
74
75
MutexTrueImpl
_lock_impl;
76
ConditionVarImpl _cvar_impl;
77
#endif // HAVE_REMUTEXTRUEIMPL
78
79
friend
class
LightReMutexDirect
;
80
};
81
82
INLINE std::ostream &
83
operator << (std::ostream &out,
const
ReMutexDirect
&m) {
84
m.
output
(out);
85
return
out;
86
}
87
88
#include "
reMutexDirect.I
"
89
90
#endif // !DEBUG_THREADS
91
92
#endif
reMutexDirect.I
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
pandabase.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
LightReMutexDirect
This class implements a standard lightReMutex by making direct calls to the underlying implementation...
Definition:
lightReMutexDirect.h:29
thread.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
mutexTrueImpl.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
ReMutexDirect
This class implements a standard reMutex by making direct calls to the underlying implementation laye...
Definition:
reMutexDirect.h:29
Thread
A thread; that is, a lightweight process.
Definition:
thread.h:46
ReMutexDirect::output
void output(std::ostream &out) const
This method is declared virtual in MutexDebug, but non-virtual in ReMutexDirect.
Definition:
reMutexDirect.cxx:24
MutexDummyImpl
A fake mutex implementation for single-threaded applications that don't need any synchronization cont...
Definition:
mutexDummyImpl.h:24
conditionVarImpl.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
Generated on Wed Jan 23 2019 21:40:14 for Panda3D by
1.8.15