remove old LINUX_NATIVE_THREADS implementation

This commit is contained in:
David Rose
2007-06-02 15:29:59 +00:00
parent faad1e333d
commit 036ad2b115
8 changed files with 2 additions and 192 deletions
+2 -9
View File
@@ -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]
-3
View File
@@ -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]
-3
View File
@@ -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 \
@@ -1,5 +1,4 @@
#include "mutexDummyImpl.cxx"
#include "mutexLinuxImpl.cxx"
#include "mutexPosixImpl.cxx"
#include "mutexWin32Impl.cxx"
#include "mutexSpinlockImpl.cxx"
-50
View File
@@ -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;
}
-64
View File
@@ -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 <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
-57
View File
@@ -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
-5
View File
@@ -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.