System.Threading.TTask.Create

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

constructor Create(Sender: TObject; Event: TNotifyEvent; const AProc: TProc; const APool: TThreadPool; const AParent: TTask; CreateFlags: TCreateFlags = []); overload;
constructor Create; overload; // do not call this constructor!!
class function Create(Sender: TObject; Event: TNotifyEvent): ITask; overload; static; inline;
class function Create(const Proc: TProc): ITask; overload; static; inline;
class function Create(Sender: TObject; Event: TNotifyEvent; const APool: TThreadPool): ITask; overload; static; inline;
class function Create(const Proc: TProc; APool: TThreadPool): ITask; overload; static; inline;

C++

__fastcall TTask(System::TObject* Sender, System::Classes::TNotifyEvent Event, const System::Sysutils::_di_TProc AProc, TThreadPool* const APool, TTask* const AParent, TCreateFlags CreateFlags)/* overload */;
__fastcall TTask(void)/* overload */;
static _di_ITask __fastcall Create(System::TObject* Sender, System::Classes::TNotifyEvent Event)/* overload */;
static _di_ITask __fastcall Create(const System::Sysutils::_di_TProc Proc)/* overload */;
static _di_ITask __fastcall Create(System::TObject* Sender, System::Classes::TNotifyEvent Event, TThreadPool* const APool)/* overload */;
static _di_ITask __fastcall Create(const System::Sysutils::_di_TProc Proc, TThreadPool* APool)/* overload */;

Properties

Type Visibility Source Unit Parent
constructor public
System.Threading.pas
System.Threading.hpp
System.Threading TTask

Description

Creates an instance of TTask managing the execution of a procedure that may execute in a parallel thread.

Create is used when directly constructing instances of TTask. Since instances of TTask only operate on procedures suitable to execute in parallel threads, one should not call the constructor without parameters for this type.

Create may be created specifying either a TProc or a TNotifyEvent to designate the procedure suitable to run in a parallel thread. In the case of a TNotifyEvent procedure, a Sender object is provided which is passed along to the parallel procedure when executed.

If desired, Create can also be given a parameter of TThreadPool from which the instance of TTask may draw the thread resources it needs. Without specifying an instance of TThreadPool, resources are drawn from a default based upon the CPU and threading capabilities of the platform.

See Also