Open Inventor Release 2024.2.1
 
Loading...
Searching...
No Matches
SbThreadRWMutex.h
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-2017 BY FEI S.A.S, ***
17 *** BORDEAUX, FRANCE ***
18 *** ALL RIGHTS RESERVED ***
19**=======================================================================*/
20/*=======================================================================
21** Author : Julien Chaplier (MMM yyyy)
22**=======================================================================*/
23
24#ifndef _SB_THREAD_RW_MUTEX_H_
25#define _SB_THREAD_RW_MUTEX_H_
26
27#if defined(_WIN32)
28#pragma warning( push )
29#pragma warning( disable: 4251 ) // 'identifier' : class 'type' needs to have dll-interface to be used by clients of class 'type2'
30#endif
31
32#include <Inventor/SbBase.h>
33#include <Inventor/SbPImpl.h>
34
35// keep this header for compatibility purpose
36#include <Inventor/threads/SbThread.h>
37#include <Inventor/threads/SbThreadSpinlock.h>
38#include <Inventor/threads/SbThreadAutoLock.h>
39
40SO_PIMPL_BASE_PUBLIC_DECLARATION(SbThreadRWMutex)
41
42
94{
95 SO_PIMPL_BASE_PUBLIC_HEADER( SbThreadRWMutex );
96
97 public:
102
103#if 1 SoDEPRECATED
105 SbThreadRWMutex( const SbBool force );
106#endif
112
118
123
128 int readlock();
129
134
135private:
136
137 // returns if someone has a lock on this mutex (even current thread)
138 // it is particularly usefull to check if the mutex can be deleted or not.
139 SbBool isUsed() const;
140
141 // version adapted for r/w try-locking. It is a little slower
142 // than the regular trylock. Synonymous for trywritelock. No
143 // trylock should be done within a readlock on the same mutex.
144 // !!! Not fully implemented
145 SbBool trywritelock();
146
147 // Equivalent to readlock but does not block if the reader cannot
148 // lock the mutex and returns FALSE. Otherwise returns TRUE.
149 // !!! Not fully implemented
150 SbBool tryreadlock();
151
152private:
153 // no copy constructor
155};
156
157#if defined(_WIN32)
158#pragma warning( pop )
159#endif
160
161#endif //_SB_THREAD_RW_MUTEX_H_
162
163
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> Portable readers...
~SbThreadRWMutex()
Destructor.
int readlock()
Request a read lock (non-exclusive access) for this mutex.
int readunlock()
Release a read lock.
int writeunlock()
Release a write lock.
int writelock()
Request a write lock (exclusive access) for this mutex.
SbThreadRWMutex()
Create a read/write mutex.
SoDEPRECATED SbThreadRWMutex(const SbBool force)
int SbBool
Boolean type.
Definition SbBase.h:87