Panda3D
panda
src
pipeline
mutexSimpleImpl.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 mutexSimpleImpl.h
10
* @author drose
11
* @date 2007-06-19
12
*/
13
14
#ifndef MUTEXSIMPLEIMPL_H
15
#define MUTEXSIMPLEIMPL_H
16
17
#include "
pandabase.h
"
18
#include "
selectThreadImpl.h
"
19
20
#ifdef THREAD_SIMPLE_IMPL
21
22
#include "
blockerSimple.h
"
23
#include "
threadSimpleImpl.h
"
24
25
/**
26
* This is the mutex implementation for the simple, simulated threads case.
27
* It's designed to be as lightweight as possible, of course. This
28
* implementation simply yields the thread when the mutex would block.
29
*
30
* We can't define this class in dtoolbase along with the other mutex
31
* implementations, because this implementation requires knowing about the
32
* SimpleThreadManager. This complicates the MutexDirect and MutexDebug
33
* definitions (we have to define a MutexImpl, for code before pipeline to use
34
* --which maps to MutexDummyImpl--and a MutexTrueImpl, for code after
35
* pipeline to use--which maps to this class, MutexSimpleImpl).
36
*/
37
class
EXPCL_PANDA_PIPELINE MutexSimpleImpl :
public
BlockerSimple {
38
public
:
39
constexpr MutexSimpleImpl() =
default
;
40
41
INLINE
void
lock();
42
INLINE
bool
try_lock();
43
INLINE
void
unlock();
44
INLINE
void
unlock_quietly();
45
46
private
:
47
void
do_lock();
48
void
do_unlock();
49
void
do_unlock_quietly();
50
51
friend
class
ThreadSimpleManager;
52
};
53
54
#include "
mutexSimpleImpl.I
"
55
56
#endif // THREAD_SIMPLE_IMPL
57
58
#endif
pandabase.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
threadSimpleImpl.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
blockerSimple.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
mutexSimpleImpl.I
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
selectThreadImpl.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
Generated on Sat Jan 11 2020 15:15:30 for Panda3D by
1.8.17