Rogue Wave banner
Previous fileTop of DocumentContentsIndex pageNext file
Threads Module Reference Guide
Rogue Wave web site:  Home Page  |  Main Documentation Page

RWTIOUEscrow<Redeemable>

Module:  Threads   Package:  Interthread Communication


RWTIOUEscrow RWTEscrowHandle<Redeemable>

Local Index

Members

Header File

#include <rw/itc/RWTIOUEscrow.h> 

Description

An RWTIOUEscrow<Redeemable> is a writable IOU handle. An IOU, also known as a future, is a promise for a value that is forthcoming -- a placeholder for that value. Usually the writer of an IOU and the reader (or readers) of an IOU are in different threads of control. In this sense IOUs are a mechanism for interthread communication.

An IOU is a write once/read many structure. It may only be written to once, but may be read any number of times.

The template parameter Redeemable is the value type of IOU result. This type must provide a public copy-constructor and must allow dynamic allocation using operator new().

The RWTIOUEscrow<Redeemable> is the handle through which a value is eventually written to an underlying escrow object. One or more readers may redeem that value once it is available by using any RWTIOUResult<Redeemable> handle that is bound to the same escrow instance.

An RWTIOUEscrow<Redeemable> is a reference counted handle to an RWTEscrowImp<Redeemable>. It can be copied and passed by value. When the last handle to a given RWTEscrowImp<Redeemable> is destroyed, then the internal RWTEscrowImp<Redeemable> is destroyed.

An RWTIOUEscrow<Redeemable> can be initialized by or assigned to an RWTIOUResult<Redeemable>, and visa versa. Both are interfaces to the same underlying RWTIOUEscrowImp<Redeemable>. RWTIOUEscrow<Redeemable> is a write interface, and RWTIOUResult<Redeemable> is a read interface.

An exception may be set on an IOU by the holder of an RWTIOUEscrow<Redeemable>. This will cause the exception to be thrown when an attempt is made to redeem it.

Similarly, an IOU may be aborted by the holder of an RWTIOUResult<Redeemable>. This will cause an exception to be thrown if an attempt is made to redeem the IOU or to set its value.

An RWTIOUEscrow<Redeemable> is closable if a value has not been set, if it has not been aborted, and if an exception has not been set.

Example

Public Typedef

typedef Redeemable RedeemableType;

Public Constructors

RWTIOUEscrow();
RWTIOUEscrow(const RWTEscrowHandle<Redeemable>& escrowHandle);
RWTIOUEscrow(const RWTIOUEscrow<Redeemable>& second);

Public Destructor

~RWTIOUEscrow();

Public Member Operators

RWTIOUEscrow<Redeemable>&
operator=(const RWTIOUEscrow<Redeemable>& second);
void
operator=(Redeemable value)
void
operator()(Redeemable value)

Public Member Functions

bool
aborted() const;
void
close(const Redeemable& value);
bool
closeable() const;
bool
closed();
bool
inError();
RWTIOUEscrow<Redeemable>
newInstance() const;
bool
redeemed() const;
void
setException(const RWTHRxmsg& xmsg);

See Also

RWTIOUResult<Redeemable>, RWTEscrowHandle<Redeemable>, RWTEscrowImp<Redeemable>, RWTThreadEscrowImp<Redeemable>, rwtMakeThreadIOU()



Previous fileTop of DocumentContentsIndex pageNext file

© Copyright Rogue Wave Software, Inc. All Rights Reserved.
Rogue Wave and SourcePro are registered trademarks of Rogue Wave Software, Inc. in the United States and other countries. All other trademarks are the property of their respective owners.
Contact Rogue Wave about documentation or support issues.