Panda3D
|
00001 // Filename: atomicAdjust.h 00002 // Created by: drose (09Aug02) 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 ATOMICADJUST_H 00016 #define ATOMICADJUST_H 00017 00018 #include "dtoolbase.h" 00019 #include "selectThreadImpl.h" 00020 00021 #if defined(THREAD_DUMMY_IMPL)||defined(THREAD_SIMPLE_IMPL) 00022 00023 #include "atomicAdjustDummyImpl.h" 00024 typedef AtomicAdjustDummyImpl AtomicAdjust; 00025 00026 #elif defined(__i386__) || defined(_M_IX86) 00027 // For an i386 architecture, we'll always use the i386 implementation. 00028 // It should be safe for any OS, and it might be a bit faster than 00029 // any OS-provided calls. 00030 00031 #include "atomicAdjustI386Impl.h" 00032 typedef AtomicAdjustI386Impl AtomicAdjust; 00033 00034 // These symbols are defined if the compare_and_exchange() methods are 00035 // implemented natively, without recourse to external locks. If these 00036 // are not defined, users may elect to implement an operation with 00037 // some other method than compare_and_exchange(), which might be 00038 // faster. 00039 #define HAVE_ATOMIC_COMPARE_AND_EXCHANGE 1 00040 #define HAVE_ATOMIC_COMPARE_AND_EXCHANGE_PTR 1 00041 00042 #elif defined(THREAD_WIN32_IMPL) 00043 00044 #include "atomicAdjustWin32Impl.h" 00045 typedef AtomicAdjustWin32Impl AtomicAdjust; 00046 00047 #define HAVE_ATOMIC_COMPARE_AND_EXCHANGE 1 00048 #define HAVE_ATOMIC_COMPARE_AND_EXCHANGE_PTR 1 00049 00050 #elif defined(THREAD_LINUX_IMPL) 00051 00052 #error Linux native threads are currently implemented only for i386; use Posix threads instead. 00053 00054 #elif defined(THREAD_POSIX_IMPL) 00055 00056 #include "atomicAdjustPosixImpl.h" 00057 typedef AtomicAdjustPosixImpl AtomicAdjust; 00058 00059 #endif 00060 00061 #endif