System.Threading.IFuture

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

IFuture<T> = interface(ITask)

C++

template<typename T> __interface IFuture__1  : public ITask

Properties

Type Visibility Source Unit Parent
interface
class
public
System.Threading.pas
System.Threading.hpp
System.Threading System.Threading

Description

IFuture implements ITask to have a function able to run in a parallel thread that returns a specific type when needed. The type being specified by the generic type parameter T. (See Generics).

IFuture<T> is a return type of TTask.Future<T> which is given a function to launch in a parallel thread after the Start method is called.

The return value of the function called from the IFuture<T> instance is accessed by the property, Value, which will immediately execute if the return value is available or wait for the function in the parallel thread to complete.

You can use an instance of IFuture<T> to set the process running and then get the result ready at the point you want. This allows you to prioritize code blocks to run in the order you want, but still ensure you get the value at the point you need it.

See Also