I'd like to have some work done in a background thread as simple as creating a Future var for it and then asking later for the calculated value.
In pseudo-C#-code:
AsyncFuture<int> asyncFuture = new AsyncFuture<int>(FuncToCalculateValue);
//do some other work, or draw UI
if(asyncFuture.NoErrorsHappened){
int realResult = asyncResult.Value;
}
I can implement such type by my own, but my question is: isn't that some kind of a known pattern? Is there maybe a name for it, or maybe even a framework implementation? Probably in .NET 4.0?
And if it is a pattern, what are the pitfalls associated with it?