Idiosyncrasies of Delphi's TThreadPool

As expected of a good thread pool, Delphi's implementation allows you to set the minimum and maximum number of executing threads. The maximum number of executing threads represents a hard limit of the maximum number of concurrently executing tasks. If you create more tasks than that, some of them will wait until the threads in the pool finish executing previous tasks.

The minimum number of executing threads sets the number of threads that are always waiting for new tasks. Setting this number to a high value preallocates a large number of threads, which allows a large number of tasks to quickly start when needed.

At least, that is the theory. The implementation, however, can be best described as weird. ...

Get Mastering Delphi Programming: A Complete Reference Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.