Open Inventor Release 2024.1.0
 
Loading...
Searching...
No Matches
SbThreadAutoLock.h
Go to the documentation of this file.
1/*=======================================================================
2 *** THE CONTENT OF THIS WORK IS PROPRIETARY TO FEI S.A.S, (FEI S.A.S.), ***
3 *** AND IS DISTRIBUTED UNDER A LICENSE AGREEMENT. ***
4 *** ***
5 *** REPRODUCTION, DISCLOSURE, OR USE, IN WHOLE OR IN PART, OTHER THAN AS ***
6 *** SPECIFIED IN THE LICENSE ARE NOT TO BE UNDERTAKEN EXCEPT WITH PRIOR ***
7 *** WRITTEN AUTHORIZATION OF FEI S.A.S. ***
8 *** ***
9 *** RESTRICTED RIGHTS LEGEND ***
10 *** USE, DUPLICATION, OR DISCLOSURE BY THE GOVERNMENT OF THE CONTENT OF THIS ***
11 *** WORK OR RELATED DOCUMENTATION IS SUBJECT TO RESTRICTIONS AS SET FORTH IN ***
12 *** SUBPARAGRAPH (C)(1) OF THE COMMERCIAL COMPUTER SOFTWARE RESTRICTED RIGHT ***
13 *** CLAUSE AT FAR 52.227-19 OR SUBPARAGRAPH (C)(1)(II) OF THE RIGHTS IN ***
14 *** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 52.227-7013. ***
15 *** ***
16 *** COPYRIGHT (C) 1996-2014 BY FEI S.A.S, ***
17 *** BORDEAUX, FRANCE ***
18 *** ALL RIGHTS RESERVED ***
19**=======================================================================*/
20/*=======================================================================
21** Author : David Beilloin (Feb 2008)
22**=======================================================================*/
23
24#ifndef _SB_THREAD_AUTO_LOCK_H_
25#define _SB_THREAD_AUTO_LOCK_H_
26
27#include <Inventor/SbBase.h>
29
30class SbThreadRWMutex;
31
73 public:
79 {
80 m_mutex = mutex;
81 if ( m_mutex )
82 m_mutex->lock();
83 }
84
86 {
87 m_mutex = &mutex;
88 m_mutex->lock();
89 }
90
91#ifndef HIDDEN_FROM_DOC
93 {
94 if ( m_mutex )
95 m_mutex->unlock();
96 }
97#endif // HIDDEN_FROM_DOC
98
99 private:
100 SbThreadMutex *m_mutex;
101};
102
147 public:
155
156#ifndef HIDDEN_FROM_DOC
161#endif
162
167 int unlock();
172 int relock();
173
174 private:
175 SbThreadRWMutex *m_mutex;
176 SbBool m_isLocked;
177
178};
179
226 public:
234
235#ifndef HIDDEN_FROM_DOC
240#endif
241
246 int unlock();
251 int relock();
252
253 private:
254 SbThreadRWMutex *m_mutex;
255 SbBool m_isLocked;
256
257};
258
259#endif //_SB_THREAD_AUTO_LOCK_H_
260
261
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> Provides reliabl...
SbThreadAutoLock(SbThreadMutex &mutex)
SbThreadAutoLock(SbThreadMutex *mutex)
Creates a mutex "autolock" object and automatically calls the mutex lock method.
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> Provides reliabl...
int unlock()
Explicitly unlock the associated mutex.
SbThreadAutoReadLock(SbThreadRWMutex &mutex)
int relock()
Explicitly relock the associated mutex.
SbThreadAutoReadLock(SbThreadRWMutex *mutex)
Creates a mutex "autolock" object and automatically calls the mutex readlock method.
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> Provides reliabl...
int relock()
Explicitly relock the associated mutex.
SbThreadAutoWriteLock(SbThreadRWMutex *mutex)
Creates a mutex "autolock" object and automatically calls the mutex writelock method.
SbThreadAutoWriteLock(SbThreadRWMutex &mutex)
int unlock()
Explicitly unlock the associated mutex.
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> Portable mutex c...
int lock()
Locks the current thread on this mutex.
int unlock()
Relinquishes ownership of this mutex.
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> Portable readers...
int SbBool
Boolean type.
Definition SbBase.h:87