Panda3D
lightMutex.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 lightMutex.h
10  * @author drose
11  * @date 2008-10-08
12  */
13 
14 #ifndef LIGHTMUTEX_H
15 #define LIGHTMUTEX_H
16 
17 #include "pandabase.h"
18 #include "mutexDebug.h"
19 #include "lightMutexDirect.h"
20 
21 /**
22  * This is a standard, non-reentrant mutex, similar to the Mutex class. It is
23  * different from Mutex in the case of SIMPLE_THREADS: in this case, the
24  * LightMutex class compiles to nothing; it performs no locking whatsoever.
25  * It is therefore useful only to protect very small sections of code, during
26  * which you are confident there will be no thread yields.
27  *
28  * In the normal, system-threaded implementation, this class is exactly the
29  * same as Mutex.
30  *
31  * ConditionVars cannot be used with LightMutex; they work only with Mutex.
32  *
33  * This class inherits its implementation either from MutexDebug or
34  * LightMutexDirect, depending on the definition of DEBUG_THREADS.
35  */
36 #ifdef DEBUG_THREADS
37 class EXPCL_PANDA_PIPELINE LightMutex : public MutexDebug
38 #else
39 class EXPCL_PANDA_PIPELINE LightMutex : public LightMutexDirect
40 #endif // DEBUG_THREADS
41 {
42 PUBLISHED:
43  INLINE LightMutex();
44 public:
45  INLINE explicit LightMutex(const char *name);
46 PUBLISHED:
47  INLINE explicit LightMutex(const std::string &name);
48  LightMutex(const LightMutex &copy) = delete;
49  ~LightMutex() = default;
50 
51  LightMutex &operator = (const LightMutex &copy) = delete;
52 };
53 
54 #include "lightMutex.I"
55 
56 #endif
pandabase.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
lightMutexDirect.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
LightMutex
This is a standard, non-reentrant mutex, similar to the Mutex class.
Definition: lightMutex.h:39
LightMutexDirect
This class implements a lightweight Mutex by making direct calls to the underlying implementation lay...
Definition: lightMutexDirect.h:31
lightMutex.I
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
mutexDebug.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.