pvAccessCPP
7.1.7
|
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... | |
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.
epics::pvAccess::ReferenceCountingLock::ReferenceCountingLock | ( | ) |
Constructor of ReferenceCountingLock
.
After construction lock is free and reference count equals 1
.
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.
msecs | the number of milleseconds to wait. An argument less than or equal to zero means not to wait at all. |
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.
int epics::pvAccess::ReferenceCountingLock::increment | ( | ) |
Increment number of references.