I am having a problem sometimes with a deadlock when destroying some threads. I\'ve tried to debug the problem but the deadlock never seems to exist when debugging in the ID
Delphi's TThread object (and inheriting classes) already calls WaitFor when destroying, but it depends on whether you created the thread with CreateSuspended or not. If you are using CreateSuspended=true to perform extra initialization before calling the first Resume, you should consider creating your own constructor (calling inherited Create(false);) that performs the extra initialization.