changed: auto add updateData callback to stages so that stagedata can be updated...
[opensg.git] / Source / Base / Threading / OSGLockPolicies.h
blobcf709db73b274910d7b6ad612ccbff396f5b6890
1 /*---------------------------------------------------------------------------*\
2 * OpenSG *
3 * *
4 * *
5 * Copyright (C) 2000-2003 by the OpenSG Forum *
6 * *
7 * www.opensg.org *
8 * *
9 * contact: dirk@opensg.org, gerrit.voss@vossg.org, jbehr@zgdv.de *
10 * *
11 \*---------------------------------------------------------------------------*/
12 /*---------------------------------------------------------------------------*\
13 * License *
14 * *
15 * This library is free software; you can redistribute it and/or modify it *
16 * under the terms of the GNU Library General Public License as published *
17 * by the Free Software Foundation, version 2. *
18 * *
19 * This library is distributed in the hope that it will be useful, but *
20 * WITHOUT ANY WARRANTY; without even the implied warranty of *
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
22 * Library General Public License for more details. *
23 * *
24 * You should have received a copy of the GNU Library General Public *
25 * License along with this library; if not, write to the Free Software *
26 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *
27 * *
28 \*---------------------------------------------------------------------------*/
29 /*---------------------------------------------------------------------------*\
30 * Changes *
31 * *
32 * *
33 * *
34 * *
35 * *
36 * *
37 \*---------------------------------------------------------------------------*/
39 #ifndef _OSGLOCKPOLICIES_H_
40 #define _OSGLOCKPOLICIES_H_
41 #ifdef __sgi
42 #pragma once
43 #endif
45 #include "OSGBaseTypes.h"
46 #include "OSGBaseFunctions.h"
47 #include "OSGBaseInitFunctions.h"
49 #include "OSGLock.h"
51 #include <boost/bind.hpp>
53 OSG_BEGIN_NAMESPACE
55 /*! \ingroup GrpBaseMultiThreading
56 \ingroup GrpLibOSGBase
57 \nohierarchy
60 class NoLockPolicy
63 /*========================== PUBLIC =================================*/
65 public:
67 /*---------------------------------------------------------------------*/
68 /*! \name Constructors */
69 /*! \{ */
71 NoLockPolicy(void);
73 /*! \} */
74 /*---------------------------------------------------------------------*/
75 /*! \name Destructor */
76 /*! \{ */
78 virtual ~NoLockPolicy(void);
80 /*! \} */
81 /*---------------------------------------------------------------------*/
82 /*! \name Reference Counting */
83 /*! \{ */
85 void acquire(void);
86 void release(void);
87 bool request(void);
89 /*! \} */
90 /*========================= PROTECTED ===============================*/
92 protected:
94 /*========================== PRIVATE ================================*/
96 private:
98 /*!\brief prohibit default function (move to 'public' if needed) */
99 NoLockPolicy(const NoLockPolicy &source);
100 void operator =(const NoLockPolicy &source);
104 /*! \ingroup GrpBaseMultiThreading
105 \ingroup GrpLibOSGBase
106 \nohierarchy
109 class SingleLockPolicy
112 /*========================== PUBLIC =================================*/
114 public:
116 /*---------------------------------------------------------------------*/
117 /*! \name Constructors */
118 /*! \{ */
120 SingleLockPolicy(void);
122 /*! \} */
123 /*---------------------------------------------------------------------*/
124 /*! \name Destructor */
125 /*! \{ */
127 virtual ~SingleLockPolicy(void);
129 /*! \} */
130 /*---------------------------------------------------------------------*/
131 /*! \name Reference Counting */
132 /*! \{ */
134 void acquire(void);
135 void release(void);
136 bool request(void);
138 /*! \} */
139 /*========================= PROTECTED ===============================*/
141 protected:
143 LockRefPtr _pLock;
145 /*========================== PRIVATE ================================*/
147 private:
149 /*!\brief prohibit default function (move to 'public' if needed) */
150 SingleLockPolicy(const SingleLockPolicy &source);
151 void operator =(const SingleLockPolicy &source);
155 /*! \ingroup GrpBaseMultiThreading
156 \ingroup GrpLibOSGBase
157 \nohierarchy
160 class SingleStaticInitLockPolicy
163 /*========================== PUBLIC =================================*/
165 public:
167 /*---------------------------------------------------------------------*/
168 /*! \name Constructors */
169 /*! \{ */
171 SingleStaticInitLockPolicy(void);
173 /*! \} */
174 /*---------------------------------------------------------------------*/
175 /*! \name Destructor */
176 /*! \{ */
178 virtual ~SingleStaticInitLockPolicy(void);
180 /*! \} */
181 /*---------------------------------------------------------------------*/
182 /*! \name Reference Counting */
183 /*! \{ */
185 /*! \} */
186 /*---------------------------------------------------------------------*/
187 /*! \name Reference Counting */
188 /*! \{ */
190 void acquire(void);
191 void release(void);
192 bool request(void);
194 /*! \} */
195 /*========================= PROTECTED ===============================*/
197 protected:
199 LockRefPtr _pLock;
201 bool init (void);
202 bool shutdown(void);
204 /*========================== PRIVATE ================================*/
206 private:
208 /*!\brief prohibit default function (move to 'public' if needed) */
209 SingleStaticInitLockPolicy(const SingleStaticInitLockPolicy &source);
210 void operator =(const SingleStaticInitLockPolicy &source);
213 OSG_END_NAMESPACE
215 #include "OSGLockPolicies.inl"
217 #endif /* _OSGLOCKPOLICIES_H_ */