pvAccessCPP  7.1.6
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 Member Functions

 POINTER_DEFINITIONS (ReferenceCountingLock)
 
 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

◆ ReferenceCountingLock()

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

Constructor of ReferenceCountingLock.

After construction lock is free and reference count equals 1.

Member Function Documentation

◆ acquire()

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.

◆ decrement()

int epics::pvAccess::ReferenceCountingLock::decrement ( )

Decrement number of references.

Returns
number of references.

◆ increment()

int epics::pvAccess::ReferenceCountingLock::increment ( )

Increment number of references.

Returns
number of references.

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