SourcePro® API Reference Guide

 
List of all members | Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Member Functions
RWTThreadEscrowImp< Redeemable > Class Template Reference

Multithread-safe implementation of RWTEscrowImp. More...

#include <rw/thread/RWTThreadEscrowImp.h>

Inheritance diagram for RWTThreadEscrowImp< Redeemable >:
RWTEscrowImp< Redeemable > RWEscrowImpBase RWBodyBase RWTCountingBody< RWMutexLock > RWTMonitor< RWMutexLock >

Public Types

typedef Redeemable RedeemableType
 
- Public Types inherited from RWTEscrowImp< Redeemable >
typedef Redeemable RedeemableType
 
typedef RWTFunctor< void(RWTEscrowHandle< Redeemable >)> RWTIOUResultCallback
 

Public Member Functions

virtual ~RWTThreadEscrowImp ()
 
- Public Member Functions inherited from RWTEscrowImp< Redeemable >
virtual ~RWTEscrowImp (void)
 
void abort (void)
 
bool aborted (void) const
 
void addCallback (const RWTIOUResultCallback &iouResultCallback)
 
void close (const Redeemable &value)
 
bool closeable (void) const
 
bool closed (void) const
 
bool inError (void) const
 
RWTEscrowHandle< Redeemable > newInstance (void) const
 
const Redeemable & redeem (void) const
 
bool redeemable (void) const
 
bool redeemed (void) const
 
void removeCallback (const RWTIOUResultCallback &iouResultCallback)
 
void setException (const RWTHRxmsg &xmsg)
 

Static Public Member Functions

static RWTEscrowHandle< Redeemable > make ()
 
static RWTEscrowHandle< Redeemable > make (const Redeemable &immediateValue)
 

Protected Member Functions

 RWTThreadEscrowImp ()
 
- Protected Member Functions inherited from RWTEscrowImp< Redeemable >
 RWTEscrowImp (void)
 
- Protected Member Functions inherited from RWEscrowImpBase
 RWEscrowImpBase (void)
 
virtual ~RWEscrowImpBase (void)
 
- Protected Member Functions inherited from RWBodyBase
 RWBodyBase (void)
 
 RWBodyBase (RWStaticCtor)
 
 RWBodyBase (const RWBodyBase &second)
 
virtual ~RWBodyBase (void)
 
RWBodyBaseoperator= (const RWBodyBase &second)
 
- Protected Member Functions inherited from RWTCountingBody< RWMutexLock >
 RWTCountingBody (unsigned initCount=0)
 
 RWTCountingBody (RWStaticCtor)
 
 RWTCountingBody (const RWTCountingBody< RWMutexLock > &second)
 
RWTCountingBody< RWMutexLock > & operator= (const RWTCountingBody< RWMutexLock > &second)
 
 ~RWTCountingBody (void)
 
unsigned addReference (void)
 
unsigned references (void) const
 
unsigned removeReference (void)
 
- Protected Member Functions inherited from RWTMonitor< RWMutexLock >
 RWTMonitor ()
 
 RWTMonitor (RWStaticCtor)
 
 RWTMonitor (const RWTMonitor< RWMutexLock > &second)
 
 ~RWTMonitor ()
 
void acquire ()
 
bool isAcquired () const
 
RWTMonitor< RWMutexLock > & monitor () const
 
RWMutexLockmutex ()
 
RWTMonitor< RWMutexLock > & operator= (const RWTMonitor< RWMutexLock > &)
 
void release ()
 
bool tryAcquire ()
 

Private Member Functions

 RWTThreadEscrowImp (const RWTThreadEscrowImp &second)
 
RWTThreadEscrowImpoperator= (const RWTThreadEscrowImp &second)
 

Additional Inherited Members

- Protected Types inherited from RWTCountingBody< RWMutexLock >
typedef RWTLockGuard< RWTMonitor< RWMutexLock > > LockGuard
 
typedef RWTTryLockGuard< RWTMonitor< RWMutexLock > > TryLockGuard
 
typedef RWTUnlockGuard< RWTMonitor< RWMutexLock > > UnlockGuard
 
- Protected Types inherited from RWTMonitor< RWMutexLock >
typedef RWTLockGuard< RWTMonitor< RWMutexLock > > LockGuard
 
typedef RWTTryLockGuard< RWTMonitor< RWMutexLock > > TryLockGuard
 
typedef RWTUnlockGuard< RWTMonitor< RWMutexLock > > UnlockGuard
 

Detailed Description

template<class Redeemable>
class RWTThreadEscrowImp< Redeemable >

This is a concrete implementation of the RWTEscrowImp class. It is multithread-safe and uses condition variables to communicate between threads.

This class should not be used directly. It is intended to be used through the RWTIOUResult and RWTIOUEscrow interfaces. However, you may wish to use the static make() functions provided by this class to construct an escrow instance.

Example
#include <rw/thread/RWTThreadEscrowImp.h>
#include <rw/itc/RWTIOUResult.h>
#include <rw/itc/RWTIOUEscrow.h>
// Create a new RWTThreadEscrowImp<int> impl.,
// and use it to initialize RWTIOUResult<int>.
RWTIOUResult<int> intRes = RWTThreadEscrowImp<int>::make();
// Make an RWTIOUEscrow<int> handle that points
// to same RWTThreadEscrowImp<int> as intRes.
RWTIOUEscrow<int> intEsc = intRes;
// Create a new RWTThreadEscrowImp<RWCString>, and
// use it to initialize an RWTIOUEscrow<RWCString>
// Just for the sake of demonstration, make an
// RWTIOUResult<RWCString> that points to same
// RWTThreadEscrowImp<RWCString> as strEsc.
RWTIOUResult<RWCString> strRes = strEsc;
See also
RWTIOUResult, RWTIOUEscrow, RWTEscrowImp

Member Typedef Documentation

template<class Redeemable >
typedef Redeemable RWTThreadEscrowImp< Redeemable >::RedeemableType

Public typedef.

Constructor & Destructor Documentation

template<class Redeemable >
virtual RWTThreadEscrowImp< Redeemable >::~RWTThreadEscrowImp ( )
virtual

Virtual destructor.

template<class Redeemable >
RWTThreadEscrowImp< Redeemable >::RWTThreadEscrowImp ( )
protected

The constructor for this class is protected. You must use the static make() members to create instances.

template<class Redeemable >
RWTThreadEscrowImp< Redeemable >::RWTThreadEscrowImp ( const RWTThreadEscrowImp< Redeemable > &  second)
private

Copy construction prohibited.

Member Function Documentation

template<class Redeemable >
static RWTEscrowHandle<Redeemable> RWTThreadEscrowImp< Redeemable >::make ( )
static

Creates a new RWTThreadEscrowImp. Returns an RWTEscrowHandle handle that can be used to create an RWTIOUResult or RWTIOUEscrow handle to the newly-created escrow implementation.

template<class Redeemable >
static RWTEscrowHandle<Redeemable> RWTThreadEscrowImp< Redeemable >::make ( const Redeemable &  immediateValue)
static

Creates an RWTThreadEscrowImp and assigns it to an RWTEscrowHandle. The escrow is closed immediately with immediateValue. The returned RWTEscrowHandle can be used to initialize an RWTIOUEscrow or RWTIOUResult. Once the escrow is created it is immediately redeemable.

template<class Redeemable >
RWTThreadEscrowImp& RWTThreadEscrowImp< Redeemable >::operator= ( const RWTThreadEscrowImp< Redeemable > &  second)
private

Assignment prohibited.

Copyright © 2022 Rogue Wave Software, Inc., a Perforce company. All Rights Reserved.