Mutex
Go to the documentation of this file.
/* -*-c++-*- OpenThreads library, Copyright (C) 2002 - 2007 The Open Thread Group
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
//
// Mutex - C++ mutex class
// ~~~~~
//
#ifndef _OPENTHREADS_MUTEX_
#define _OPENTHREADS_MUTEX_
#include <OpenThreads/Exports>
namespace OpenThreads {
class OPENTHREAD_EXPORT_DIRECTIVE Mutex {
friend class Condition;
public:
enum MutexType
{
MUTEX_NORMAL,
MUTEX_RECURSIVE
};
Mutex(MutexType type=MUTEX_NORMAL);
virtual ~Mutex();
MutexType getMutexType() const { return _mutexType; }
virtual int lock();
virtual int unlock();
virtual int trylock();
private:
Mutex(const Mutex &/*m*/) {};
Mutex &operator=(const Mutex &/*m*/) {return *(this);};
void *_prvData;
MutexType _mutexType;
};
}
#endif // _OPENTHREADS_MUTEX_
Exports
OPENTHREAD_EXPORT_DIRECTIVE
#define OPENTHREAD_EXPORT_DIRECTIVE
Definition Exports:20
OpenThreads::Mutex
This class provides an object-oriented thread mutex interface.
Definition Mutex:31
OpenThreads::Mutex::Condition
friend class Condition
Definition Mutex:33
OpenThreads::Mutex::~Mutex
virtual ~Mutex()
OpenThreads::Mutex::MutexType
MutexType
Definition Mutex:38
OpenThreads::Mutex::MUTEX_NORMAL
@ MUTEX_NORMAL
Definition Mutex:39
OpenThreads::Mutex::MUTEX_RECURSIVE
@ MUTEX_RECURSIVE
Definition Mutex:40
OpenThreads::Mutex::unlock
virtual int unlock()
OpenThreads::Mutex::getMutexType
MutexType getMutexType() const
Definition Mutex:54
OpenThreads::Mutex::Mutex
Mutex(MutexType type=MUTEX_NORMAL)
OpenThreads::Mutex::lock
virtual int lock()
OpenThreads::Mutex::trylock
virtual int trylock()
OpenThreads
Definition Affinity:26