Skip to content

Thread implementation support both FireMonkey, VCL frameworks.

Notifications You must be signed in to change notification settings

ydhn/DelphiEasyThread

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DelphiEasyThread

Simple thread implementation support both FireMonkey, VCL frameworks.

How to use

You should contain AnonThread.pas to your project, then you can import it to your unit.

uses AnonThread;

Define your thread.

FThread: TAnonymousThread<String>;

This thread will return String value to OnComplete procedure. You can change returning data type. TAnonymousThread.create requires anonymous functions(closures) as it's parameters.

FThread := TAnonymousThread<String>.Create(

Implement your "to do" works in this function.

  function: String begin
    Button1.Enabled := false;
    Result := idhttp1.Get('http://google.com');
  end,

Implement what will you do when that works are finished in this procedure.

  procedure(AResult: String) begin
    Button1.Enabled := true;
    Memo1.Text := AResult;
  end,

And handling exceptions in the next procedure.

  procedure(AException: Exception) begin
    showmessage(AException.ToString);
  end,
false);

Example

This repository is an example implementation using AnonThread, making an Indy HTTP component to get http transaction.

About

Thread implementation support both FireMonkey, VCL frameworks.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages