June 2016
Intermediate to advanced
470 pages
9h 49m
English
TMonitor is a record used to synchronize threads. Just to be clear, we are talking about System.TMonitor, not Vcl.Forms.TMonitor.
Since Delphi 2009, the TObject instance size has been doubled to make room for an additional 4 bytes. What are these 4 bytes for? They provide TMonitor support!
Now, every TObject descendant can be used as a lock. The type that allows this is the System.TMonitor record, which implements a generic monitor synchronization structure.
In this recipe, you'll face one of the classic multithreading problems—concurrent access to a shared file. Specifically, you'll have a lot of threads writing some information on a file—the same file—and all the threads have to be synchronized ...
Read now
Unlock full access