Einfache Lösung: eine globale Integer Variable per TCriticalSection sichern und dann in den Threads eim Start erhöhen und am Ende verringern.
Alternativ kann mann TIdThreadSafeInteger aus
Indy oder InterlockedIncrement/Decrement aus der Windows
API verwenden (ist in Delphi bereits unterstützt).
p.s.: die
OmniThreadLibrary ist noch erwähnenswert.
Zitat:
OmniThreadLibrary is simple to use threading library for Delphi. Currently, versions 2007, 2009, and 2010 are supported. OmniThreadLibrary is an open source project. It lives in the Google Code and is licensed under the BSD license.
...
OTL's main "selling" points (besides the price, of course
are power, simplicity, and openess. With just few lines of code, you can set up multiple threads, send messages between them, process Windows messages and more.
TThreadList ist keine Liste von Threads