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

Polling

For the last approach, I will show a solution that doesn't require any support from an operating system or runtime library. You can implement it with standard tools, for example, with a timer, list, and critical section.

Unlike the previous solutions, which followed a push model (a message triggers some code in the main thread that can't do much to prevent that), this approach requires cooperation from code running in a main thread. This code will periodically check (poll) whether a message has arrived.

To implement this kind of messaging system, both the main thread and the background thread must share some structure that can store a list of messages and which is thread-safe (can be safely used in a multi-threaded environment). We ...

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