Rules about Threads and IOUs
Threads use IOUs in the following ways:
*Threads attempting to redeem an IOU that has not been closed, block until another thread writes a result or exception to the IOU object.
*If an IOU is closed with an exception, any attempt to redeem the IOU produces that exception:
try {
result = iou.redeem();
cout << "Operation succeeded! " << result << endl;
}
catch(RWException& msg) {
cout << "Operation failed! " << msg.why() << endl;
}
*A thread can redeem an IOU as many times as it wants.
*An IOU can be shared between and redeemed by any number of threads.