Figure 2: Class ResultIOU_ definition

#ifndef __RESULTIOU__H_
#define __RESULTIOU__H_

#include "refcountbase.h"
#include "mutex.h"
#include "event.h"

template<class T>
class ResultIOU_ : public RefCountBase
{
public:
    ResultIOU_();
    virtual ~ResultIOU_();
    ResultIOU_(const ResultIOU_& rhs);
    ResultIOU_& 
    operator=(const ResultIOU_& rhs);

    void Abort();
    T Redeem();
    bool Redeemable() const;
    bool Aborted() const;
    void Close(T t);

private:
    T t_;
    Event closedEvent_;
    Mutex mutex_;
    bool resultReady_;
    bool aborted_;
};