Panda3D
 All Classes Functions Variables Enumerations
mutexImpl.h
1 // Filename: mutexImpl.h
2 // Created by: drose (08Aug02)
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 MUTEXIMPL_H
16 #define MUTEXIMPL_H
17 
18 #include "dtoolbase.h"
19 #include "selectThreadImpl.h"
20 
21 #if defined(THREAD_DUMMY_IMPL)||defined(THREAD_SIMPLE_IMPL)
22 
23 #include "mutexDummyImpl.h"
26 #define HAVE_REMUTEXIMPL 1
27 
28 #elif defined(MUTEX_SPINLOCK)
29 
30 #include "mutexSpinlockImpl.h"
31 typedef MutexSpinlockImpl MutexImpl;
32 #undef HAVE_REMUTEXIMPL
33 
34 #elif defined(THREAD_WIN32_IMPL)
35 
36 #include "mutexWin32Impl.h"
37 typedef MutexWin32Impl MutexImpl;
38 typedef MutexWin32Impl ReMutexImpl; // Win32 Mutexes are always reentrant.
39 #define HAVE_REMUTEXIMPL 1
40 
41 #elif defined(THREAD_POSIX_IMPL)
42 
43 #include "mutexPosixImpl.h"
44 typedef MutexPosixImpl MutexImpl;
45 typedef ReMutexPosixImpl ReMutexImpl;
46 #define HAVE_REMUTEXIMPL 1
47 
48 #endif
49 
50 // Also define what a true OS-provided lock will be, even if we don't
51 // have threading enabled in the build. Sometimes we need to
52 // interface with an external program or something that wants real
53 // locks.
54 #if defined(WIN32_VC)
55 #include "mutexWin32Impl.h"
56 typedef MutexWin32Impl TrueMutexImpl;
57 
58 #elif defined(HAVE_POSIX_THREADS)
59 #include "mutexPosixImpl.h"
60 typedef MutexPosixImpl TrueMutexImpl;
61 
62 #else
63 // No true threads, sorry. Better not try to use 'em.
64 
65 #endif
66 
67 #endif
68 
69 
70 
A fake mutex implementation for single-threaded applications that don't need any synchronization cont...