Skip to Main Content
Mastering Delphi Programming: A Complete Reference Guide
book

Mastering Delphi Programming: A Complete Reference Guide

by Primož Gabrijelčič
November 2019
Beginner to intermediate content levelBeginner to intermediate
674 pages
15h
English
Packt Publishing
Content preview from Mastering Delphi Programming: A Complete Reference Guide

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 GUI Programming with FireMonkey

Delphi GUI Programming with FireMonkey

Andrea Magni
Delphi Cookbook - Third Edition

Delphi Cookbook - Third Edition

Daniele Spinetti, Daniele Teti

Publisher Resources

ISBN: 9781838989118Other