Panda3D
|
00001 // Filename: mutexImpl.h 00002 // Created by: drose (08Aug02) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) Carnegie Mellon University. All rights reserved. 00008 // 00009 // All use of this software is subject to the terms of the revised BSD 00010 // license. You should have received a copy of this license along 00011 // with this source code in a file named "LICENSE." 00012 // 00013 //////////////////////////////////////////////////////////////////// 00014 00015 #ifndef MUTEXIMPL_H 00016 #define MUTEXIMPL_H 00017 00018 #include "dtoolbase.h" 00019 #include "selectThreadImpl.h" 00020 00021 #if defined(THREAD_DUMMY_IMPL)||defined(THREAD_SIMPLE_IMPL) 00022 00023 #include "mutexDummyImpl.h" 00024 typedef MutexDummyImpl MutexImpl; 00025 typedef MutexDummyImpl ReMutexImpl; 00026 #define HAVE_REMUTEXIMPL 1 00027 00028 #elif defined(MUTEX_SPINLOCK) 00029 00030 #include "mutexSpinlockImpl.h" 00031 typedef MutexSpinlockImpl MutexImpl; 00032 #undef HAVE_REMUTEXIMPL 00033 00034 #elif defined(THREAD_WIN32_IMPL) 00035 00036 #include "mutexWin32Impl.h" 00037 typedef MutexWin32Impl MutexImpl; 00038 typedef MutexWin32Impl ReMutexImpl; // Win32 Mutexes are always reentrant. 00039 #define HAVE_REMUTEXIMPL 1 00040 00041 #elif defined(THREAD_POSIX_IMPL) 00042 00043 #include "mutexPosixImpl.h" 00044 typedef MutexPosixImpl MutexImpl; 00045 typedef ReMutexPosixImpl ReMutexImpl; 00046 #define HAVE_REMUTEXIMPL 1 00047 00048 #endif 00049 00050 // Also define what a true OS-provided lock will be, even if we don't 00051 // have threading enabled in the build. Sometimes we need to 00052 // interface with an external program or something that wants real 00053 // locks. 00054 #if defined(WIN32_VC) 00055 #include "mutexWin32Impl.h" 00056 typedef MutexWin32Impl TrueMutexImpl; 00057 00058 #elif defined(HAVE_POSIX_THREADS) 00059 #include "mutexPosixImpl.h" 00060 typedef MutexPosixImpl TrueMutexImpl; 00061 00062 #else 00063 // No true threads, sorry. Better not try to use 'em. 00064 00065 #endif 00066 00067 #endif 00068 00069 00070