pvAccessCPP  7.1.7
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Public Types | Public Member Functions | List of all members
epics::pvAccess::ReferenceCountingLock Class Reference

Reference counting mutex implementation w/ deadlock detection. More...

#include <utils/pv/referenceCountingLock.h>

Public Types

typedef std::tr1::shared_ptr
< ReferenceCountingLock
shared_pointer
 
typedef std::tr1::shared_ptr
< const ReferenceCountingLock
const_shared_pointer
 
typedef std::tr1::weak_ptr
< ReferenceCountingLock
weak_pointer
 
typedef std::tr1::weak_ptr
< const ReferenceCountingLock
const_weak_pointer
 

Public Member Functions

 ReferenceCountingLock ()
 Constructor of ReferenceCountingLock. More...
 
virtual ~ReferenceCountingLock ()
 Destructor of ReferenceCountingLock.
 
bool acquire (epics::pvData::int64 msecs)
 Attempt to acquire lock. More...
 
void release ()
 Release previously acquired lock.
 
int increment ()
 Increment number of references. More...
 
int decrement ()
 Decrement number of references. More...
 

Detailed Description

Reference counting mutex implementation w/ deadlock detection.

Synchronization helper class used (intended for use) for activation/deactivation synchronization. This class enforces attempt method of acquiring the locks to prevent deadlocks. Class also offers reference counting. (NOTE: automatic lock counting was not implemented due to imperfect usage.)

Definition at line 35 of file referenceCountingLock.h.

Constructor & Destructor Documentation

epics::pvAccess::ReferenceCountingLock::ReferenceCountingLock ( )

Constructor of ReferenceCountingLock.

After construction lock is free and reference count equals 1.

Member Function Documentation

bool epics::pvAccess::ReferenceCountingLock::acquire ( epics::pvData::int64  msecs)

Attempt to acquire lock.

NOTE: Argument msecs is currently not supported due to Darwin OS not supporting pthread_mutex_timedlock. May be changed in the future.

Parameters
msecsthe number of milleseconds to wait. An argument less than or equal to zero means not to wait at all.
Returns
true if acquired, false otherwise. NOTE: currently this routine always returns true. Look above for explanation.
int epics::pvAccess::ReferenceCountingLock::decrement ( )

Decrement number of references.

Returns
number of references.
int epics::pvAccess::ReferenceCountingLock::increment ( )

Increment number of references.

Returns
number of references.

The documentation for this class was generated from the following file: