ALib C++ Library
Library Version: 2412 R0
Documentation generated by doxygen
Loading...
Searching...
No Matches
OwnerTry< TOwnable > Class Template Reference

Description:

template<typename TOwnable>
class alib::lang::OwnerTry< TOwnable >

Similar to class Owner, but calls method TryAcquire instead of Acquire. The result is retrievable with method IsOwning().

See also
Chapter 3.3.1 Class Owner And Its Siblings of the Programmer's Manual of module ALib Threads
Template Parameters
TOwnableThe type to own. Requirements are to have methods TryAcquire and Release available.

Definition at line 95 of file owner.hpp.

#include <owner.hpp>

Collaboration diagram for OwnerTry< TOwnable >:
[legend]

Public Method Index:

 OwnerTry (TOwnable &ownable, const CallerInfo &ci)
 
 ~OwnerTry ()
 Destructor. Invokes Release() on member owned.
 
bool IsOwning () const noexcept
 

Protected Field Index:

CallerInfo dbgCI
 Caller information. Available only with debug-builds.
 
bool isOwning
 The result of the call to TryAcquire.
 
TOwnable & owned
 The resource to acquire and release.
 

Field Details:

◆ dbgCI

template<typename TOwnable >
CallerInfo dbgCI
protected

Caller information. Available only with debug-builds.

Definition at line 103 of file owner.hpp.

◆ isOwning

template<typename TOwnable >
bool isOwning
protected

The result of the call to TryAcquire.

Definition at line 101 of file owner.hpp.

◆ owned

template<typename TOwnable >
TOwnable& owned
protected

The resource to acquire and release.

Definition at line 100 of file owner.hpp.

Constructor(s) / Destructor Details:

◆ OwnerTry()

template<typename TOwnable >
OwnerTry ( TOwnable & ownable,
const CallerInfo & ci )
inline

Constructor. Invokes TryAcquire() on member owned.

Parameters
ownableThe ownable to acquire.
ciCaller information.

Definition at line 135 of file owner.hpp.

◆ ~OwnerTry()

template<typename TOwnable >
~OwnerTry ( )
inline

Destructor. Invokes Release() on member owned.

Definition at line 145 of file owner.hpp.

Method Details:

◆ IsOwning()

template<typename TOwnable >
bool IsOwning ( ) const
inlinenoexcept
Returns
true if the try to acquire the owned with construction of this type was successful, false otherwise.

Definition at line 149 of file owner.hpp.


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