Skip to Main Content
Delphi High Performance
book

Delphi High Performance

by Primož Gabrijelčič
February 2018
Intermediate to advanced content levelIntermediate to advanced
336 pages
7h 52m
English
Packt Publishing
Content preview from Delphi High Performance

Join/Await

Another way to work around the TParallel.Join problem is to create a different implementation of the same pattern. As with the Async/Await pattern, I've created a version that supports the Join/Await pattern.

As with the TParallel version, Join accepts multiple TProc parameters. It, however, doesn't return an ITask interface but IJoin. This interface is similar to the IAsync interface used for the Async/Await pattern. It implements two versions of the Await method. One is the same as in the IAsync version, while the other can be used to catch exceptions raised in tasks:

type  IJoin = interface ['{ED4B4531-B233-4A02-A09A-13EE488FCCA3}']    procedure Await(const awaitProc: TProc); overload; procedure Await(const awaitProc: TProc<Exception>); ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Delphi Cookbook

Delphi Cookbook

Daniele Teti

Publisher Resources

ISBN: 9781788625456Supplemental Content