본문 바로가기
DELPHI(델파이)

[Delphi] 병렬 프로그래밍

by Jcoder 2020. 12. 3.

1. TTask

System.Threading.TTask - RAD Studio API Documentation (embarcadero.com)

 

System.Threading.TTask - RAD Studio API Documentation

From RAD Studio API Documentation Delphi TTask = class(TAbstractTask, TThreadPool.IThreadPoolWorkItem, ITask, TAbstractTask.IInternalTask) C++ class PASCALIMPLEMENTATION TTask : public TAbstractTask Properties Type Visibility Source Unit Parent class publi

docwiki.embarcadero.com

uses

  System.Threading;

 

TTask.Run(

    procedure

    begin

 

        TThread.Synchronize(nil, // 메인 쓰레드와 동기화(gui 건들시)

        procedure

        begin

 

        end);

    end);

 

2. OtlParallel

Documentation - The Ultimate Delphi Threading Library (omnithreadlibrary.com)

 

Documentation - The Ultimate Delphi Threading Library

Parallel Programming with OmniThreadLibrary I wrote a book about the OmniThreadLibrary called Parallel Programming with OmniThreadLibrary. It covers all aspects of OmniThreadLibrary and is available in electronic and printed edition. The book is also avail

www.omnithreadlibrary.com

uses

  OtlParallel, OtlTaskControl, ActiveX;

 

Parallel.Async( // 비동기 실행

    procedure

    Begin

      CoInitialize(nil);

      try

 

      finally

        CoUninitialize;

      end;

    end,

    Parallel.TaskConfig.OnTerminated( // 위에 작업이 끝나고 아래 gui 건들시

    procedure(const task: IOmniTaskControl)

    begin

 

 

    end)

    );