OFuture, OFutureRef A future represents the result of an asynchronous operation
OFuture, OFutureRef A future represents the result of an asynchronous operation. It allows one or several "consumers" or "users" of that result to be blocked only if they actually need to access the result and only if the result has not yet been computed by the asynchronous operation. Consider a web-browser with seperate threads for downloading and viewing pictures. The downloading thread offers its result (the picture data) as a "future". If the display-threads trys to access the data, it is blocked until the download-thread declares the data as valid. Now we might have several threads, unaware of each other, wanting to use the same data. How should one of these threads know when it's safe to delete the data represented by the future? To solve this problem, we use reference-counting on the future object. To hide the difficulties of calling addRef/reseaseRef operations from the user, we use OFutureRef-Objects instead of OFutures. The first created OFutureRef-Object actually creates the OFuture. Now we can make as much copies of this OFutureRef-Object as are needed, with each copy only the reference-count of the underlying OFuture is increased. Each thread done with its OFutureRef can just delete it (or let it run out of scope, if created on the stack). Only if the last OFutureRef is gone, the OFuture will be deleted.
T getData()
T* getDataPtr()
void dataValid()
this page has been generated automatically by doc++
(c)opyright by Malte Zöckler, Roland Wunderling
contact: doc++@zib.de