Przeglądaj źródła

remove old LINUX_NATIVE_THREADS implementation

David Rose 18 lat temu
rodzic
commit
036ad2b115

+ 2 - 9
dtool/Config.pp

@@ -668,13 +668,6 @@
 // (pthread_create(), etc.), define this true.
 // (pthread_create(), etc.), define this true.
 #define HAVE_POSIX_THREADS $[and $[isfile /usr/include/pthread.h],$[not $[WINDOWS_PLATFORM]]]
 #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)?
 // Do you want to build in support for threading (multiprocessing)?
 // Building in support for threading will enable Panda to take
 // Building in support for threading will enable Panda to take
 // advantage of multiple CPU's if you have them (and if the OS
 // advantage of multiple CPU's if you have them (and if the OS
@@ -683,8 +676,8 @@
 // enabled by default.
 // enabled by default.
 
 
 // You should only turn this on if you have some threading library
 // 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 HAVE_THREADS
 #define THREADS_LIBS $[if $[not $[WINDOWS_PLATFORM]],pthread]
 #define THREADS_LIBS $[if $[not $[WINDOWS_PLATFORM]],pthread]
 
 

+ 0 - 3
dtool/LocalSetup.pp

@@ -471,9 +471,6 @@ $[cdefine HAVE_RTTI]
 /* Do we have Posix threads? */
 /* Do we have Posix threads? */
 $[cdefine 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? */
 /* Is the code being compiled with the Tau profiler's instrumentor? */
 $[cdefine USE_TAU]
 $[cdefine USE_TAU]
 
 

+ 0 - 3
dtool/src/dtoolbase/Sources.pp

@@ -22,7 +22,6 @@
     memoryBase.h \
     memoryBase.h \
     mutexImpl.h \
     mutexImpl.h \
     mutexDummyImpl.h mutexDummyImpl.I \
     mutexDummyImpl.h mutexDummyImpl.I \
-    mutexLinuxImpl.h mutexLinuxImpl.I \
     mutexPosixImpl.h mutexPosixImpl.I \
     mutexPosixImpl.h mutexPosixImpl.I \
     mutexWin32Impl.h mutexWin32Impl.I \
     mutexWin32Impl.h mutexWin32Impl.I \
     mutexSpinlockImpl.h mutexSpinlockImpl.I \
     mutexSpinlockImpl.h mutexSpinlockImpl.I \
@@ -48,7 +47,6 @@
     dtoolbase.cxx \
     dtoolbase.cxx \
     memoryBase.cxx \
     memoryBase.cxx \
     mutexDummyImpl.cxx \
     mutexDummyImpl.cxx \
-    mutexLinuxImpl.cxx \
     mutexPosixImpl.cxx \
     mutexPosixImpl.cxx \
     mutexWin32Impl.cxx \
     mutexWin32Impl.cxx \
     mutexSpinlockImpl.cxx \
     mutexSpinlockImpl.cxx \
@@ -72,7 +70,6 @@
     memoryBase.h \
     memoryBase.h \
     mutexImpl.h \
     mutexImpl.h \
     mutexDummyImpl.h mutexDummyImpl.I \
     mutexDummyImpl.h mutexDummyImpl.I \
-    mutexLinuxImpl.h mutexLinuxImpl.I \
     mutexPosixImpl.h mutexPosixImpl.I \
     mutexPosixImpl.h mutexPosixImpl.I \
     mutexWin32Impl.h mutexWin32Impl.I \
     mutexWin32Impl.h mutexWin32Impl.I \
     mutexSpinlockImpl.h mutexSpinlockImpl.I \
     mutexSpinlockImpl.h mutexSpinlockImpl.I \

+ 0 - 1
dtool/src/dtoolbase/dtoolbase_composite2.cxx

@@ -1,5 +1,4 @@
 #include "mutexDummyImpl.cxx"
 #include "mutexDummyImpl.cxx"
-#include "mutexLinuxImpl.cxx"
 #include "mutexPosixImpl.cxx"
 #include "mutexPosixImpl.cxx"
 #include "mutexWin32Impl.cxx"
 #include "mutexWin32Impl.cxx"
 #include "mutexSpinlockImpl.cxx"
 #include "mutexSpinlockImpl.cxx"

+ 0 - 50
dtool/src/dtoolbase/mutexLinuxImpl.I

@@ -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
-// [email protected] .
-//
-////////////////////////////////////////////////////////////////////
-
-
-////////////////////////////////////////////////////////////////////
-//     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;
-}

+ 0 - 64
dtool/src/dtoolbase/mutexLinuxImpl.cxx

@@ -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
-// [email protected] .
-//
-////////////////////////////////////////////////////////////////////
-
-#include "selectThreadImpl.h"
-
-#ifdef HAVE_LINUX_NATIVE_THREADS
-
-#include "mutexLinuxImpl.h"
-#include "atomicAdjust.h"
-
-#include <linux/futex.h>
-#include <sys/time.h>
-#include <sys/syscall.h>
-
-////////////////////////////////////////////////////////////////////
-//     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

+ 0 - 57
dtool/src/dtoolbase/mutexLinuxImpl.h

@@ -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
-// [email protected] .
-//
-////////////////////////////////////////////////////////////////////
-
-#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

+ 0 - 5
dtool/src/dtoolbase/selectThreadImpl.h

@@ -54,11 +54,6 @@
 // In Windows, use the native threading library.
 // In Windows, use the native threading library.
 #define THREAD_WIN32_IMPL 1
 #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)
 #elif defined(HAVE_POSIX_THREADS)
 
 
 // Posix threads are nice.
 // Posix threads are nice.