ucommon
Data Structures | Namespaces | Defines | Typedefs | Functions
ucommon/access.h File Reference

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

#include <ucommon/platform.h>
#include <ucommon/cpr.h>
Include dependency graph for access.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

class  ucommon::exclusive_lock
 A kind of smart pointer object to support exclusive locking protocol. More...
class  ucommon::ExclusiveProtocol
 An exclusive locking protocol interface base. More...
class  ucommon::shared_lock
 A kind of smart pointer object to support shared locking protocol. More...
class  ucommon::SharedProtocol
 An exclusive locking protocol interface base. More...

Namespaces

namespace  ucommon
 

Common namespace for all ucommon objects.


Defines

#define _UCOMMON_ACCESS_H_
#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 ucommon::exlock_t
 Convenience type to use for object referencing an exclusive object.
typedef shared_lock ucommon::shlock_t
 Convenience type to use for object referencing a shared object.

Functions

void ucommon::access (SharedProtocol *object)
 Convenience function to access (lock) shared object through it's protocol.
void ucommon::exclusive (SharedProtocol *object)
 Convenience function to exclusive lock shared object through it's protocol.
void ucommon::lock (ExclusiveProtocol *object)
 Convenience function to exclusively lock an object through it's protocol.
void ucommon::release (SharedProtocol *object)
 Convenience function to unlock shared object through it's protocol.
void ucommon::release (exlock_t &reference)
 Convenience function to release a reference to an exclusive lock.
void ucommon::release (shlock_t &reference)
 Convenience function to release a reference to a shared lock.
void ucommon::share (SharedProtocol *object)
 Convenience function to restore shared locking for object through it's protocol.
void ucommon::unlock (ExclusiveProtocol *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.