OpenThreads
Mutex
Go to the documentation of this file.
1/* -*-c++-*- OpenThreads library, Copyright (C) 2002 - 2007 The Open Thread Group
2 *
3 * This library is open source and may be redistributed and/or modified under
4 * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
5 * (at your option) any later version. The full license is in LICENSE file
6 * included with this distribution, and on the openscenegraph.org website.
7 *
8 * This library is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * OpenSceneGraph Public License for more details.
12*/
13
14
15//
16// Mutex - C++ mutex class
17// ~~~~~
18//
19
20#ifndef _OPENTHREADS_MUTEX_
21#define _OPENTHREADS_MUTEX_
22
23#include <OpenThreads/Exports>
24
25namespace OpenThreads {
26
32
33 friend class Condition;
34
35public:
36
42
47
51 virtual ~Mutex();
52
53
54 MutexType getMutexType() const { return _mutexType; }
55
56
62 virtual int lock();
63
69 virtual int unlock();
70
76 virtual int trylock();
77
78private:
79
83 Mutex(const Mutex &/*m*/) {};
84
88 Mutex &operator=(const Mutex &/*m*/) {return *(this);};
89
93 void *_prvData;
94 MutexType _mutexType;
95
96};
97
98}
99
100#endif // _OPENTHREADS_MUTEX_
#define OPENTHREAD_EXPORT_DIRECTIVE
Definition Exports:20
Definition Affinity:26
This class provides an object-oriented thread mutex interface.
Definition Mutex:31
friend class Condition
Definition Mutex:33
virtual ~Mutex()
Destructor.
MutexType
Definition Mutex:38
@ MUTEX_NORMAL
Definition Mutex:39
@ MUTEX_RECURSIVE
Definition Mutex:40
virtual int unlock()
Unlock the mutex.
MutexType getMutexType() const
Definition Mutex:54
Mutex(MutexType type=MUTEX_NORMAL)
Constructor.
virtual int lock()
Lock the mutex.
virtual int trylock()
Test if mutex can be locked.

osg logo
Generated at Sun Jul 20 2025 00:00:00 for the OpenThreads by doxygen 1.14.0.