55class __EXPORT ExclusiveProtocol
58 virtual ~ExclusiveProtocol();
60 virtual void _lock(
void) = 0;
62 virtual void _unlock(
void) = 0;
72 class __EXPORT Locking
75 ExclusiveProtocol *lock;
77 __DELETE_COPY(Locking);
84 Locking(ExclusiveProtocol *
object);
95 inline bool operator!()
const {
103 inline operator bool()
const {
122class __EXPORT SharedProtocol
125 virtual ~SharedProtocol();
130 virtual void _share(
void) = 0;
132 virtual void _unshare(
void) = 0;
142 class __EXPORT Locking
145 SharedProtocol *lock;
154 Locking(SharedProtocol *
object);
156 Locking(
const Locking&
copy);
158 Locking& operator=(
const Locking&
copy);
169 inline bool operator!()
const {
177 inline operator bool()
const {
191 void exclusive(
void);
205 virtual void share(
void);
214 virtual void exclusive(
void);
224class __EXPORT shared_access
227 SharedProtocol *lock;
236 shared_access(SharedProtocol *
object);
238 shared_access(
const shared_access&
copy);
240 shared_access& operator=(
const shared_access&
copy);
251 inline bool operator!()
const {
259 inline operator bool()
const {
273 void exclusive(
void);
282class autoexclusive :
private ExclusiveProtocol::Locking
285 __DELETE_DEFAULTS(autoexclusive);
288 inline autoexclusive(T *lock) :
289 Locking(polystatic_cast<ExclusiveProtocol *>(lock)) {};
293class autoshared :
private SharedProtocol::Locking
296 __DELETE_DEFAULTS(autoshared);
299 inline autoshared(T *lock) :
300 Locking(polystatic_cast<SharedProtocol *>(lock)) {};
308#define __EXCLUSIVE(x) exclusive_access __autolock__ = x
309#define __SHARE(x) shared_access __autolock__ = x