diff --git a/dtool/Config.pp b/dtool/Config.pp index 59b15b03af..b91882f730 100644 --- a/dtool/Config.pp +++ b/dtool/Config.pp @@ -668,13 +668,6 @@ // (pthread_create(), etc.), define this true. #define HAVE_POSIX_THREADS $[and $[isfile /usr/include/pthread.h],$[not $[WINDOWS_PLATFORM]]] -// If you're building for an i386 Linux machine, kernel version 2.6 or -// higher, and you want to use native Linux threading operations -// instead of Posix threads, define this. Warning: this is highly -// experimental code, is likely to crash, and will probably be removed -// in the future. Use Posix threads instead; they're much better. -#define HAVE_LINUX_NATIVE_THREADS - // Do you want to build in support for threading (multiprocessing)? // Building in support for threading will enable Panda to take // advantage of multiple CPU's if you have them (and if the OS @@ -683,8 +676,8 @@ // enabled by default. // You should only turn this on if you have some threading library -// available (most people will have one). Windows has one built-in. -// Linux uses Posix threads, which most Linuxes provide. +// available (you probably do). Windows has one built-in. Linux and +// OSX use Posix threads. #define HAVE_THREADS #define THREADS_LIBS $[if $[not $[WINDOWS_PLATFORM]],pthread] diff --git a/dtool/LocalSetup.pp b/dtool/LocalSetup.pp index 8061690382..8302a6e799 100644 --- a/dtool/LocalSetup.pp +++ b/dtool/LocalSetup.pp @@ -471,9 +471,6 @@ $[cdefine HAVE_RTTI] /* Do we have Posix threads? */ $[cdefine HAVE_POSIX_THREADS] -/* Do we want to build for Linux native threads? */ -$[cdefine HAVE_LINUX_NATIVE_THREADS] - /* Is the code being compiled with the Tau profiler's instrumentor? */ $[cdefine USE_TAU] diff --git a/dtool/src/dtoolbase/Sources.pp b/dtool/src/dtoolbase/Sources.pp index c468d73c8d..b9aadbb60d 100644 --- a/dtool/src/dtoolbase/Sources.pp +++ b/dtool/src/dtoolbase/Sources.pp @@ -22,7 +22,6 @@ memoryBase.h \ mutexImpl.h \ mutexDummyImpl.h mutexDummyImpl.I \ - mutexLinuxImpl.h mutexLinuxImpl.I \ mutexPosixImpl.h mutexPosixImpl.I \ mutexWin32Impl.h mutexWin32Impl.I \ mutexSpinlockImpl.h mutexSpinlockImpl.I \ @@ -48,7 +47,6 @@ dtoolbase.cxx \ memoryBase.cxx \ mutexDummyImpl.cxx \ - mutexLinuxImpl.cxx \ mutexPosixImpl.cxx \ mutexWin32Impl.cxx \ mutexSpinlockImpl.cxx \ @@ -72,7 +70,6 @@ memoryBase.h \ mutexImpl.h \ mutexDummyImpl.h mutexDummyImpl.I \ - mutexLinuxImpl.h mutexLinuxImpl.I \ mutexPosixImpl.h mutexPosixImpl.I \ mutexWin32Impl.h mutexWin32Impl.I \ mutexSpinlockImpl.h mutexSpinlockImpl.I \ diff --git a/dtool/src/dtoolbase/dtoolbase_composite2.cxx b/dtool/src/dtoolbase/dtoolbase_composite2.cxx index 23b746c82f..83cffac3b1 100644 --- a/dtool/src/dtoolbase/dtoolbase_composite2.cxx +++ b/dtool/src/dtoolbase/dtoolbase_composite2.cxx @@ -1,5 +1,4 @@ #include "mutexDummyImpl.cxx" -#include "mutexLinuxImpl.cxx" #include "mutexPosixImpl.cxx" #include "mutexWin32Impl.cxx" #include "mutexSpinlockImpl.cxx" diff --git a/dtool/src/dtoolbase/mutexLinuxImpl.I b/dtool/src/dtoolbase/mutexLinuxImpl.I deleted file mode 100644 index 99da4c85f0..0000000000 --- a/dtool/src/dtoolbase/mutexLinuxImpl.I +++ /dev/null @@ -1,50 +0,0 @@ -// Filename: mutexLinuxImpl.I -// Created by: drose (28Mar06) -// -//////////////////////////////////////////////////////////////////// -// -// PANDA 3D SOFTWARE -// Copyright (c) 2001 - 2004, Disney Enterprises, Inc. All rights reserved -// -// All use of this software is subject to the terms of the Panda 3d -// Software license. You should have received a copy of this license -// along with this source code; you will also find a current copy of -// the license at http://etc.cmu.edu/panda3d/docs/license/ . -// -// To contact the maintainers of this program write to -// panda3d-general@lists.sourceforge.net . -// -//////////////////////////////////////////////////////////////////// - - -//////////////////////////////////////////////////////////////////// -// Function: MutexLinuxImpl::Constructor -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -INLINE MutexLinuxImpl:: -MutexLinuxImpl() { - _mode = M_unlocked; -} - -//////////////////////////////////////////////////////////////////// -// Function: MutexLinuxImpl::Destructor -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -INLINE MutexLinuxImpl:: -~MutexLinuxImpl() { - assert(_mode == M_unlocked); -} - -//////////////////////////////////////////////////////////////////// -// Function: MutexLinuxImpl::try_lock -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -INLINE bool MutexLinuxImpl:: -try_lock() { - // We haven't implemented try_lock(). We just report that it would - // always block (since we don't know). - return false; -} diff --git a/dtool/src/dtoolbase/mutexLinuxImpl.cxx b/dtool/src/dtoolbase/mutexLinuxImpl.cxx deleted file mode 100644 index 4b20d7ff87..0000000000 --- a/dtool/src/dtoolbase/mutexLinuxImpl.cxx +++ /dev/null @@ -1,64 +0,0 @@ -// Filename: mutexLinuxImpl.cxx -// Created by: drose (28Mar06) -// -//////////////////////////////////////////////////////////////////// -// -// PANDA 3D SOFTWARE -// Copyright (c) 2001 - 2004, Disney Enterprises, Inc. All rights reserved -// -// All use of this software is subject to the terms of the Panda 3d -// Software license. You should have received a copy of this license -// along with this source code; you will also find a current copy of -// the license at http://etc.cmu.edu/panda3d/docs/license/ . -// -// To contact the maintainers of this program write to -// panda3d-general@lists.sourceforge.net . -// -//////////////////////////////////////////////////////////////////// - -#include "selectThreadImpl.h" - -#ifdef HAVE_LINUX_NATIVE_THREADS - -#include "mutexLinuxImpl.h" -#include "atomicAdjust.h" - -#include -#include -#include - -//////////////////////////////////////////////////////////////////// -// Function: MutexLinuxImpl::lock -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -void MutexLinuxImpl:: -lock() { - PN_int32 c; - c = AtomicAdjust::compare_and_exchange - (_mode, M_unlocked, M_locked_no_waiters); - while (c != M_unlocked) { - if (c == M_locked_with_waiters || - AtomicAdjust::compare_and_exchange(_mode, M_locked_no_waiters, - M_locked_with_waiters) != M_unlocked) { - syscall(SYS_futex, &_mode, FUTEX_WAIT, M_locked_with_waiters, (void *)NULL); - } - c = AtomicAdjust::compare_and_exchange - (_mode, M_unlocked, M_locked_with_waiters); - } -} - -//////////////////////////////////////////////////////////////////// -// Function: MutexLinuxImpl::release -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -void MutexLinuxImpl:: -release() { - if (AtomicAdjust::dec(_mode)) { - _mode = M_unlocked; - syscall(SYS_futex, &_mode, FUTEX_WAKE, 1); - } -} - -#endif // HAVE_LINUX_NATIVE_THREADS diff --git a/dtool/src/dtoolbase/mutexLinuxImpl.h b/dtool/src/dtoolbase/mutexLinuxImpl.h deleted file mode 100644 index fee0e8a995..0000000000 --- a/dtool/src/dtoolbase/mutexLinuxImpl.h +++ /dev/null @@ -1,57 +0,0 @@ -// Filename: mutexLinuxImpl.h -// Created by: drose (28Mar06) -// -//////////////////////////////////////////////////////////////////// -// -// PANDA 3D SOFTWARE -// Copyright (c) 2001 - 2004, Disney Enterprises, Inc. All rights reserved -// -// All use of this software is subject to the terms of the Panda 3d -// Software license. You should have received a copy of this license -// along with this source code; you will also find a current copy of -// the license at http://etc.cmu.edu/panda3d/docs/license/ . -// -// To contact the maintainers of this program write to -// panda3d-general@lists.sourceforge.net . -// -//////////////////////////////////////////////////////////////////// - -#ifndef MUTEXLINUXIMPL_H -#define MUTEXLINUXIMPL_H - -#include "dtoolbase.h" -#include "selectThreadImpl.h" - -#ifdef HAVE_LINUX_NATIVE_THREADS - -#include "numeric_types.h" - -//////////////////////////////////////////////////////////////////// -// Class : MutexLinuxImpl -// Description : Uses Linux threads to implement a mutex. -//////////////////////////////////////////////////////////////////// -class EXPCL_DTOOL MutexLinuxImpl { -public: - INLINE MutexLinuxImpl(); - INLINE ~MutexLinuxImpl(); - - void lock(); - INLINE bool try_lock(); - void release(); - -private: - enum Mode { - M_unlocked = 0, - M_locked_no_waiters = 1, - M_locked_with_waiters = 2, - }; - - PN_int32 _mode; - friend class ConditionVarLinuxImpl; -}; - -#include "mutexLinuxImpl.I" - -#endif // HAVE_LINUX_NATIVE_THREADS - -#endif diff --git a/dtool/src/dtoolbase/selectThreadImpl.h b/dtool/src/dtoolbase/selectThreadImpl.h index 8b02dd8da5..43c8fbd662 100644 --- a/dtool/src/dtoolbase/selectThreadImpl.h +++ b/dtool/src/dtoolbase/selectThreadImpl.h @@ -54,11 +54,6 @@ // In Windows, use the native threading library. #define THREAD_WIN32_IMPL 1 -#elif defined(HAVE_LINUX_NATIVE_THREADS) - -// In Linux, we might want to use the low-level system calls. -#define THREAD_LINUX_IMPL 1 - #elif defined(HAVE_POSIX_THREADS) // Posix threads are nice.