Robot Raconteur Core C++ Library
Loading...
Searching...
No Matches
RobotRaconteur::RobotRaconteurNode::ScopedMonitorLock Class Reference

Wrapper for RobotRaconteurNode::MonitorEnter() and RobotRaconteurNode::MonitorExit() to take advantage of RAII scoping. More...

#include <RobotRaconteurNode.h>

Public Member Functions

boost::shared_ptr< RobotRaconteurNodeGetNode ()
 Get the Node associated with the lock.
 ScopedMonitorLock (const boost::shared_ptr< RRObject > &obj, int32_t timeout=-1)
 Create a monitor lock for the specified object.
void lock (int32_t timeout=-1)
 Relock the object after calling unlock().
void unlock ()
 Releases the monitor lock.
void release ()
 Release the monitor lock from the class.

Detailed Description

Wrapper for RobotRaconteurNode::MonitorEnter() and RobotRaconteurNode::MonitorExit() to take advantage of RAII scoping.

Constructor & Destructor Documentation

◆ ScopedMonitorLock()

RobotRaconteur::RobotRaconteurNode::ScopedMonitorLock::ScopedMonitorLock ( const boost::shared_ptr< RRObject > & obj,
int32_t timeout = -1 )

Create a monitor lock for the specified object.

Creates a monitor lock by calling RobotRaconteur::MonitorEnter(). Object will be locked once the object is created.

Parameters
objThe object to monitor lock
timeoutThe timeout in milliseconds to acquire the monitor lock, or RR_TIMEOUT_INFINITE

Member Function Documentation

◆ GetNode()

boost::shared_ptr< RobotRaconteurNode > RobotRaconteur::RobotRaconteurNode::ScopedMonitorLock::GetNode ( )

Get the Node associated with the lock.

Returns
RR_SHARED_PTR<RobotRaconteurNode>

◆ lock()

void RobotRaconteur::RobotRaconteurNode::ScopedMonitorLock::lock ( int32_t timeout = -1)

Relock the object after calling unlock().

Parameters
timeoutThe timeout in milliseconds to acquire the monitor lock, or RR_TIMEOUT_INFINITE

◆ release()

void RobotRaconteur::RobotRaconteurNode::ScopedMonitorLock::release ( )

Release the monitor lock from the class.

The monitor lock is released from the ScopedMonitorLock instance. The monitor lock will not be released by the ScopedMonitorLock destructor.

◆ unlock()

void RobotRaconteur::RobotRaconteurNode::ScopedMonitorLock::unlock ( )

Releases the monitor lock.

The ScopedMonitorLock destructor will release the lock automatically, so in most cases it is not necessary to call this function


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