Name
IsMultiThread Variable
Syntax
var IsMultiThread: Boolean;
Description
Delphi automatically sets
IsMultiThread
to True when you create a thread using
BeginThread or with the TThread
class in the Classes unit. You can test
IsMultiThread and avoid some thread-protection
overhead when it is False.
Tips and Tricks
Delphi’s memory manager checks
IsMultiThreadand uses critical sections to protect the integrity of its internal data structures. Therefore, if you create a thread by calling the Windows API functionCreateThread, you must explicitly setIsMultiThreadto True.Delphi also sets
IsMultiThreadto True for web servers and COM servers that don’t force single threading (tmSinglethreading model).If you write your own DLL that might be loaded by a multithreaded application, set
IsMultiThreadto True. If you useDllProcto learn when more than one thread attaches to the DLL, you must realize the application might start multiple threads before loading the DLL.
See Also
| BeginThread Function, DllProc Variable, ThreadVar Keyword |
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.
Read now
Unlock full access