open_toontown_panda3d/panda/src/pipeline/mutexDirect.I

109 lines
4.0 KiB
Plaintext
Executable File

// Filename: mutexDirect.I
// Created by: drose (13Feb06)
//
////////////////////////////////////////////////////////////////////
//
// 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: MutexDirect::Constructor
// Access: Protected
// Description:
////////////////////////////////////////////////////////////////////
INLINE MutexDirect::
MutexDirect() {
}
////////////////////////////////////////////////////////////////////
// Function: MutexDirect::Destructor
// Access: Protected
// Description:
////////////////////////////////////////////////////////////////////
INLINE MutexDirect::
~MutexDirect() {
}
////////////////////////////////////////////////////////////////////
// Function: MutexDirect::Copy Constructor
// Access: Private
// Description: Do not attempt to copy mutexes.
////////////////////////////////////////////////////////////////////
INLINE MutexDirect::
MutexDirect(const MutexDirect &copy) {
nassertv(false);
}
////////////////////////////////////////////////////////////////////
// Function: MutexDirect::Copy Assignment Operator
// Access: Private
// Description: Do not attempt to copy mutexes.
////////////////////////////////////////////////////////////////////
INLINE void MutexDirect::
operator = (const MutexDirect &copy) {
nassertv(false);
}
////////////////////////////////////////////////////////////////////
// Function: MutexDirect::lock
// Access: Public
// Description: Grabs the mutex if it is available. If it is not
// available, blocks until it becomes available, then
// grabs it. In either case, the function does not
// return until the mutex is held; you should then call
// unlock().
//
// This method is considered const so that you can lock
// and unlock const mutexes, mainly to allow thread-safe
// access to otherwise const data.
//
// Also see MutexHolder.
////////////////////////////////////////////////////////////////////
INLINE void MutexDirect::
lock() const {
TAU_PROFILE("void MutexDirect::lock()", " ", TAU_USER);
((MutexDirect *)this)->_impl.lock();
}
////////////////////////////////////////////////////////////////////
// Function: MutexDirect::release
// Access: Public
// Description: Releases the mutex. It is an error to call this if
// the mutex was not already locked.
//
// This method is considered const so that you can lock
// and unlock const mutexes, mainly to allow thread-safe
// access to otherwise const data.
////////////////////////////////////////////////////////////////////
INLINE void MutexDirect::
release() const {
TAU_PROFILE("void MutexDirect::release()", " ", TAU_USER);
((MutexDirect *)this)->_impl.release();
}
////////////////////////////////////////////////////////////////////
// Function: MutexDirect::debug_is_locked
// Access: Public
// Description: Returns true if the current thread has locked the
// Mutex, false otherwise. This method is only intended
// for use in debugging, hence the method name; in the
// MutexDirect case, it always returns true, since
// there's not a reliable way to determine this
// otherwise.
////////////////////////////////////////////////////////////////////
INLINE bool MutexDirect::
debug_is_locked() const {
return true;
}