Panda3D
 All Classes Functions Variables Enumerations
mutexTrueImpl.h
1 // Filename: mutexTrueImpl.h
2 // Created by: drose (19Jun07)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 #ifndef MUTEXTRUEIMPL_H
16 #define MUTEXTRUEIMPL_H
17 
18 #include "pandabase.h"
19 #include "mutexImpl.h"
20 
21 // The MutexTrueImpl typedef is given here in the pipeline directory,
22 // and is used to implement Mutex and ReMutex (and, therefore, any
23 // downstream Mutex implementation).
24 
25 // This is slightly different from the MutexImpl typedef, which is
26 // given up in dtoolbase, and is used standalone anywhere very
27 // low-level code needs to protect itself from mutual exclusion.
28 
29 // The only difference between the two is in the case of
30 // THREAD_SIMPLE_IMPL. In this case, MutexImpl maps to
31 // MutexDummyImpl, while MutexTrueImpl maps to MutexSimpleImpl. This
32 // distinction is necessary because we cannot define MutexSimpleImpl
33 // until we have defined the whole ThreadSimpleManager and related
34 // infrastructure.
35 
36 #ifdef THREAD_SIMPLE_IMPL
37 
38 #include "mutexSimpleImpl.h"
39 typedef MutexSimpleImpl MutexTrueImpl;
40 #undef HAVE_REMUTEXTRUEIMPL
41 
42 #else // THREAD_SIMPLE_IMPL
43 
44 typedef MutexImpl MutexTrueImpl;
45 #if HAVE_REMUTEXIMPL
46 typedef ReMutexImpl ReMutexTrueImpl;
47 #define HAVE_REMUTEXTRUEIMPL 1
48 #else
49 #undef HAVE_REMUTEXTRUEIMPL
50 #endif // HAVE_REMUTEXIMPL
51 
52 #endif // THREAD_SIMPLE_IMPL
53 
54 #endif
55 
56 
57 
A fake mutex implementation for single-threaded applications that don't need any synchronization cont...