Newsgroups : Borland : borland.public.delphi.internet.winsock : 2005 Aug : TIdThreadMgrPool example needed please

www.cryer.info
Managed Newsgroup Archive

TIdThreadMgrPool example needed please

Subject:TIdThreadMgrPool example needed please
Posted by:"Eric Carlson" (dont-spam-me@nospamplease.com)
Date:Sat, 6 Aug 2005 17:34:17

This looks just what I need after wrestling with my own way of doing it ;-)
However, I thought I had cracked it but found a problem I can't fix (this
will be me being dumb).
I had a working system where my thread class (TDownloadThread) was derived
from TThread. I changed it to come from TIdThread so I could use the Id pool
manager. It has Create and Delete methods. Ok so far - then found I needed
to set the class type before use, so did this in the main FormCreate:

ThreadMgrPool.ThreadClass := TDownloadThread;

and this to get new thread instances when needed
downloadThread := ThreadMgrPool.getThread As TDownloadThread;

What I find is now the threads Create method isn't being called, which means
boom when the body uses any of the objects the constructor allocates! Its
wierd because the Execute is ok, I can signle step right through until the
first nil pointer is hit, so it appears we have an object created without
going through its constructor, something I always believed was impossible.
Theres only 1 constructor defined by the way.

So what have I missed and/or is there a simple example I could user please?
Thanks...

Replies:

www.cryer.info
Managed Newsgroup Archive