Panda3D
mutexTrueImpl.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 mutexTrueImpl.h
10  * @author drose
11  * @date 2007-06-19
12  */
13 
14 #ifndef MUTEXTRUEIMPL_H
15 #define MUTEXTRUEIMPL_H
16 
17 #include "pandabase.h"
18 #include "mutexImpl.h"
19 
20 // The MutexTrueImpl typedef is given here in the pipeline directory, and is
21 // used to implement Mutex and ReMutex (and, therefore, any downstream Mutex
22 // implementation).
23 
24 // This is slightly different from the MutexImpl typedef, which is given up in
25 // dtoolbase, and is used standalone anywhere very low-level code needs to
26 // protect itself from mutual exclusion.
27 
28 // The only difference between the two is in the case of THREAD_SIMPLE_IMPL.
29 // In this case, MutexImpl maps to MutexDummyImpl, while MutexTrueImpl maps to
30 // MutexSimpleImpl. This distinction is necessary because we cannot define
31 // MutexSimpleImpl until we have defined the whole ThreadSimpleManager and
32 // related infrastructure.
33 
34 #ifdef THREAD_SIMPLE_IMPL
35 
36 #include "mutexSimpleImpl.h"
37 typedef MutexSimpleImpl MutexTrueImpl;
38 #undef HAVE_REMUTEXTRUEIMPL
39 
40 #else // THREAD_SIMPLE_IMPL
41 
42 typedef MutexImpl MutexTrueImpl;
43 #if HAVE_REMUTEXIMPL
44 typedef ReMutexImpl ReMutexTrueImpl;
45 #define HAVE_REMUTEXTRUEIMPL 1
46 
47 #elif MUTEX_SPINLOCK
48 // This is defined here because it needs code from pipeline.
49 #include "reMutexSpinlockImpl.h"
50 typedef ReMutexSpinlockImpl ReMutexTrueImpl;
51 #define HAVE_REMUTEXTRUEIMPL 1
52 
53 #else
54 #undef HAVE_REMUTEXTRUEIMPL
55 #endif // HAVE_REMUTEXIMPL
56 
57 #endif // THREAD_SIMPLE_IMPL
58 
59 #endif
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
A fake mutex implementation for single-threaded applications that don't need any synchronization cont...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.