ucommon

ucommon/access.h File Reference

Locking classes for member function automatic operations. More...

#include <ucommon/platform.h>
Include dependency graph for access.h:

Go to the source code of this file.

Data Structures

class  Exclusive
 An exclusive locking protocol interface base. More...
class  exclusive_lock
 A kind of smart pointer object to support exclusive locking protocol. More...
class  Shared
 An exclusive locking protocol interface base. More...
class  shared_lock
 A kind of smart pointer object to support shared locking protocol. More...

Defines

#define exclusive_access(x)   exlock_t __autolock__ = &x
#define exclusive_object()   exlock_t __autolock__ = this
#define protected_access(x)   shlock_t __autolock__ = &x
#define protected_object()   shlock_t __autolock__ = this

Typedefs

typedef exclusive_lock exlock_t
 Convenience type to use for object referencing an exclusive object.
typedef shared_lock shlock_t
 Convenience type to use for object referencing a shared object.

Functions

void access (Shared *object)
 Convenience function to access (lock) shared object through it's protocol.
void exclusive (Shared *object)
 Convenience function to exclusive lock shared object through it's protocol.
void lock (Exclusive *object)
 Convenience function to exclusively lock an object through it's protocol.
void release (shlock_t &reference)
 Convenience function to release a reference to a shared lock.
void release (Shared *object)
 Convenience function to unlock shared object through it's protocol.
void release (exlock_t &reference)
 Convenience function to release a reference to an exclusive lock.
void share (Shared *object)
 Convenience function to restore shared locking for object through it's protocol.
void unlock (Exclusive *object)
 Convenience function to unlock an exclusive object through it's protocol.

Detailed Description

Locking classes for member function automatic operations.

This header covers ucommon access related classes. These are used to provide automatic management of locks and synchronization objects through common virtual base classes which can be used with automatic objects. These classes are intended to be used much like "protocols" in conjunction with smart pointer/referencing classes. This protocol interface supports member functions to acquire a lock when entered and automatically release the lock when the member function returns that are used in conjunction with special referencing smart pointers.

Definition in file access.h.


Function Documentation

void access ( Shared object) [inline]

Convenience function to access (lock) shared object through it's protocol.

Parameters:
objectto share lock.

Definition at line 241 of file access.h.

void exclusive ( Shared object) [inline]

Convenience function to exclusive lock shared object through it's protocol.

Parameters:
objectto exclusive lock.

Definition at line 255 of file access.h.

void lock ( Exclusive object) [inline]

Convenience function to exclusively lock an object through it's protocol.

Parameters:
objectto lock.

Definition at line 227 of file access.h.

void release ( shlock_t reference) [inline]

Convenience function to release a reference to a shared lock.

Parameters:
referenceto object referencing shared locked object.

Definition at line 286 of file access.h.

Here is the call graph for this function:

void release ( Shared object) [inline]

Convenience function to unlock shared object through it's protocol.

Parameters:
objectto unlock.

Definition at line 248 of file access.h.

void release ( exlock_t reference) [inline]

Convenience function to release a reference to an exclusive lock.

Parameters:
referenceto object referencing exclusive locked object.

Definition at line 279 of file access.h.

Here is the call graph for this function:

void share ( Shared object) [inline]

Convenience function to restore shared locking for object through it's protocol.

Parameters:
objectto restore shared locking.

Definition at line 262 of file access.h.

void unlock ( Exclusive object) [inline]

Convenience function to unlock an exclusive object through it's protocol.

Parameters:
objectto unlock.

Definition at line 234 of file access.h.