Panda3D
panda
src
pipeline
lightMutexDirect.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 lightMutexDirect.h
10
* @author drose
11
* @date 2008-10-08
12
*/
13
14
#ifndef LIGHTMUTEXDIRECT_H
15
#define LIGHTMUTEXDIRECT_H
16
17
#include "
pandabase.h
"
18
#include "
mutexImpl.h
"
19
#include "
mutexTrueImpl.h
"
20
#include "
pnotify.h
"
21
22
class
Thread
;
23
24
#ifndef DEBUG_THREADS
25
26
/**
27
* This class implements a lightweight Mutex by making direct calls to the
28
* underlying implementation layer. It doesn't perform any debugging
29
* operations.
30
*/
31
class
EXPCL_PANDA_PIPELINE
LightMutexDirect
{
32
protected
:
33
LightMutexDirect
() =
default
;
34
LightMutexDirect
(
const
LightMutexDirect
©) =
delete
;
35
~
LightMutexDirect
() =
default
;
36
37
void
operator = (
const
LightMutexDirect
©) =
delete
;
38
39
public
:
40
INLINE
void
lock();
41
INLINE
bool
try_lock();
42
INLINE
void
unlock();
43
44
PUBLISHED:
45
BLOCKING INLINE
void
acquire()
const
;
46
INLINE
void
release()
const
;
47
INLINE
bool
debug_is_locked()
const
;
48
49
INLINE
void
set_name(
const
std::string &name);
50
INLINE
void
clear_name();
51
INLINE
bool
has_name()
const
;
52
INLINE std::string get_name()
const
;
53
54
void
output(std::ostream &out)
const
;
55
56
private
:
57
#ifdef DO_PSTATS
58
// When PStats is compiled in, we use the full implementation of LightMutex,
59
// even in the SIMPLE_THREADS case. We have to do this since any PStatTimer
60
// call may trigger a context switch, and any low-level context switch
61
// requires all containing mutexes to be true mutexes.
62
mutable
MutexTrueImpl
_impl;
63
#else
64
mutable
MutexImpl
_impl;
65
#endif // DO_PSTATS
66
};
67
68
INLINE std::ostream &
69
operator << (std::ostream &out,
const
LightMutexDirect
&m) {
70
m.
output
(out);
71
return
out;
72
}
73
74
#include "
lightMutexDirect.I
"
75
76
#endif // !DEBUG_THREADS
77
78
#endif
lightMutexDirect.I
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
LightMutexDirect
This class implements a lightweight Mutex by making direct calls to the underlying implementation lay...
Definition:
lightMutexDirect.h:31
pandabase.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
pnotify.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
mutexTrueImpl.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
mutexImpl.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
Thread
A thread; that is, a lightweight process.
Definition:
thread.h:46
LightMutexDirect::output
void output(std::ostream &out) const
This method is declared virtual in LightMutexDebug, but non-virtual in LightMutexDirect.
Definition:
lightMutexDirect.cxx:23
MutexDummyImpl
A fake mutex implementation for single-threaded applications that don't need any synchronization cont...
Definition:
mutexDummyImpl.h:24
Generated on Wed Jan 23 2019 21:40:14 for Panda3D by
1.8.15